com.google.code.rees.scope.conversation.context
Class TimeoutConversationContextManager

java.lang.Object
  extended by com.google.code.rees.scope.conversation.context.DefaultConversationContextManager
      extended by com.google.code.rees.scope.conversation.context.TimeoutConversationContextManager
All Implemented Interfaces:
ConversationContextManager, TimeoutListener<ConversationContext>, Serializable

public class TimeoutConversationContextManager
extends DefaultConversationContextManager
implements TimeoutListener<ConversationContext>

This class extends the DefaultConversationContextManager and uses a TimeoutMonitor to monitor conversations for timeouts. Using the TimeoutListener interface, it removes conversations from its cache when they have expired.

Author:
rees.byars
See Also:
Serialized Form

Field Summary
protected  TimeoutMonitor<ConversationContext> conversationTimeoutMonitor
           
 
Fields inherited from class com.google.code.rees.scope.conversation.context.DefaultConversationContextManager
contextFactory, conversations, maxInstances, nextId
 
Constructor Summary
TimeoutConversationContextManager()
           
 
Method Summary
 ConversationContext createContext(String conversationName, long maxIdleTimeMillis)
          Creates a new context for the given conversation name, using the given idle time
 void destroy()
          Cleanup and release the manager's resources
 void onTimeout(ConversationContext expiredConversation)
          Called when the given Timeoutable's timeout method is called.
 ConversationContext remove(String conversationName, String conversationId)
          Remove the context identified by the given information, returning the context being removed
 void setTimeoutMonitor(TimeoutMonitor<ConversationContext> conversationTimeoutMonitor)
           
 
Methods inherited from class com.google.code.rees.scope.conversation.context.DefaultConversationContextManager
getContext, getNextId, removeMostStaleConversation, setContextFactory, setMaxInstances
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conversationTimeoutMonitor

protected TimeoutMonitor<ConversationContext> conversationTimeoutMonitor
Constructor Detail

TimeoutConversationContextManager

public TimeoutConversationContextManager()
Method Detail

setTimeoutMonitor

public void setTimeoutMonitor(TimeoutMonitor<ConversationContext> conversationTimeoutMonitor)

createContext

public ConversationContext createContext(String conversationName,
                                         long maxIdleTimeMillis)
Creates a new context for the given conversation name, using the given idle time

Specified by:
createContext in interface ConversationContextManager
Overrides:
createContext in class DefaultConversationContextManager
Returns:

remove

public ConversationContext remove(String conversationName,
                                  String conversationId)
Remove the context identified by the given information, returning the context being removed

Specified by:
remove in interface ConversationContextManager
Overrides:
remove in class DefaultConversationContextManager
Returns:

onTimeout

public void onTimeout(ConversationContext expiredConversation)
Called when the given Timeoutable's timeout method is called.

Specified by:
onTimeout in interface TimeoutListener<ConversationContext>

destroy

public void destroy()
Cleanup and release the manager's resources

Specified by:
destroy in interface ConversationContextManager
Overrides:
destroy in class DefaultConversationContextManager


Copyright © 2012-2013. All Rights Reserved.