com.google.code.rees.scope.util.monitor
Interface Timeoutable<T extends Timeoutable<T>>

All Superinterfaces:
Serializable
All Known Subinterfaces:
ConversationContext, MonitoredContext<K,V,T>
All Known Implementing Classes:
DefaultConversationContext, HashMonitoredContext

public interface Timeoutable<T extends Timeoutable<T>>
extends Serializable

This interface can be used in conjunction with a TimeoutMonitor to provide a simple timeout mechanism

Author:
rees.byars

Method Summary
 void addTimeoutListener(TimeoutListener<T> timeoutListener)
          Add a listener whose TimeoutListener.onTimeout(Object) method will be called when this Timeoutable's timeout() method is called.
 String getId()
          A unique ID used to identify this Timeoutable
 long getRemainingTime()
          The time remaining until this Timeoutable's timeout() method will be called
 void reset()
          Resets this Timeoutable's remaining time to the max idle time
 void setMaxIdleTime(long maxIdleTime)
          Sets the time after which this Timeoutable's timeout() method will be called
 void timeout()
          Called when this Timeoutable's getRemainingTime() is equal to or less than zero (i.e.
 

Method Detail

setMaxIdleTime

void setMaxIdleTime(long maxIdleTime)
Sets the time after which this Timeoutable's timeout() method will be called

Parameters:
maxIdleTime -

getId

String getId()
A unique ID used to identify this Timeoutable

Returns:

getRemainingTime

long getRemainingTime()
The time remaining until this Timeoutable's timeout() method will be called

Returns:

timeout

void timeout()
Called when this Timeoutable's getRemainingTime() is equal to or less than zero (i.e. the max idle time has been exceeded).


reset

void reset()
Resets this Timeoutable's remaining time to the max idle time


addTimeoutListener

void addTimeoutListener(TimeoutListener<T> timeoutListener)
Add a listener whose TimeoutListener.onTimeout(Object) method will be called when this Timeoutable's timeout() method is called.

Parameters:
timeoutListener -


Copyright © 2012-2013. All Rights Reserved.