proai.service
Class SessionManager

java.lang.Object
  extended by java.lang.Thread
      extended by proai.service.SessionManager
All Implemented Interfaces:
java.lang.Runnable

public class SessionManager
extends java.lang.Thread


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static java.lang.String ERR_RESUMPTION_SESSION
           
static java.lang.String ERR_RESUMPTION_SYNTAX_INTEGER
           
static java.lang.String ERR_RESUMPTION_SYNTAX_SLASH
           
static java.lang.String PROP_BASEDIR
           
static java.lang.String PROP_SECONDSBETWEENREQUESTS
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SessionManager(java.io.File baseDir, int secondsBetweenRequests)
           
SessionManager(java.util.Properties props)
           
 
Method Summary
protected  void addSession(java.lang.String key, Session session)
          Add a session to the map of tracked sessions.
 void close()
           
 void finalize()
           
 ResponseData getResponseData(java.lang.String resumptionToken)
          Get response data from the appropriate session and return it.
<T> ResponseData
list(ListProvider<T> provider)
           
 void run()
          Session timeout reaper thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_BASEDIR

public static final java.lang.String PROP_BASEDIR
See Also:
Constant Field Values

PROP_SECONDSBETWEENREQUESTS

public static final java.lang.String PROP_SECONDSBETWEENREQUESTS
See Also:
Constant Field Values

ERR_RESUMPTION_SYNTAX_SLASH

public static final java.lang.String ERR_RESUMPTION_SYNTAX_SLASH
See Also:
Constant Field Values

ERR_RESUMPTION_SYNTAX_INTEGER

public static final java.lang.String ERR_RESUMPTION_SYNTAX_INTEGER
See Also:
Constant Field Values

ERR_RESUMPTION_SESSION

public static final java.lang.String ERR_RESUMPTION_SESSION
See Also:
Constant Field Values
Constructor Detail

SessionManager

public SessionManager(java.util.Properties props)
               throws ServerException
Throws:
ServerException

SessionManager

public SessionManager(java.io.File baseDir,
                      int secondsBetweenRequests)
Method Detail

run

public void run()
Session timeout reaper thread.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

addSession

protected void addSession(java.lang.String key,
                          Session session)
Add a session to the map of tracked sessions. This is called by any session that has multiple responses.


list

public <T> ResponseData list(ListProvider<T> provider)
                  throws ServerException
Throws:
ServerException

getResponseData

public ResponseData getResponseData(java.lang.String resumptionToken)
                             throws BadResumptionTokenException,
                                    ServerException
Get response data from the appropriate session and return it. The resumption token encodes the session id and part number. The first part is sessionid/0, the second part is sessionid/1, and so on.

Throws:
BadResumptionTokenException
ServerException

close

public void close()

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object