org.jboss.webbeans.conversation
Class ConversationEntry

java.lang.Object
  extended by org.jboss.webbeans.conversation.ConversationEntry

public class ConversationEntry
extends java.lang.Object

Represents a long-running conversation entry

Author:
Nicklas Karlsson

Constructor Summary
protected ConversationEntry(Conversation conversation, java.util.concurrent.Future<?> terminationHandle)
          Creates a new conversation entry
 
Method Summary
 boolean cancelTermination()
          Cancels the timeout termination
 void destroy(javax.servlet.http.HttpSession session)
          Destroys the conversation and it's associated conversational context
 Conversation getConversation()
           
 boolean lock(long timeout)
          Attempts to lock the conversation for exclusive usage
static ConversationEntry of(Conversation conversation, java.util.concurrent.Future<?> terminationHandle)
          Factory method
 void reScheduleTermination(java.util.concurrent.Future<?> terminationHandle)
          Re-schedules timeout termination
 boolean unlock()
          Attempts to unlock the conversation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversationEntry

protected ConversationEntry(Conversation conversation,
                            java.util.concurrent.Future<?> terminationHandle)
Creates a new conversation entry

Parameters:
cid - The conversation ID
terminationHandle - The timeout termination handle
Method Detail

of

public static ConversationEntry of(Conversation conversation,
                                   java.util.concurrent.Future<?> terminationHandle)
Factory method

Parameters:
cid - The conversation ID
terminationHandle - The timeout termination handle
Returns:
A new conversation entry

cancelTermination

public boolean cancelTermination()
Cancels the timeout termination

Returns:
True if successful, false otherwise

destroy

public void destroy(javax.servlet.http.HttpSession session)
Destroys the conversation and it's associated conversational context

Parameters:
session - The HTTP session for the backing context bean store

lock

public boolean lock(long timeout)
             throws java.lang.InterruptedException
Attempts to lock the conversation for exclusive usage

Parameters:
timeout - The time in milliseconds to wait on the lock
Returns:
True if lock was successful, false otherwise
Throws:
java.lang.InterruptedException - If the lock operation was unsuccessful

unlock

public boolean unlock()
Attempts to unlock the conversation

Returns:
true if the unlock was successful, false otherwise

reScheduleTermination

public void reScheduleTermination(java.util.concurrent.Future<?> terminationHandle)
Re-schedules timeout termination

Parameters:
terminationHandle - The fresh timeout termination handle

getConversation

public Conversation getConversation()


Copyright © 2011. All Rights Reserved.