Class SessionHolder<T>
- java.lang.Object
-
- org.marketcetera.util.ws.stateful.SessionHolder<T>
-
public class SessionHolder<T> extends Object
A session holder. It is created after successful authentication, and initially retains just the authenticated user name and client context at that time. In later calls during the same session, the service implementations may associate session data with the holder; it is the responsibility of the service implementations to ensure thread safety in manipulating that data.- Since:
- 1.0.0
- Version:
- $Id: SessionHolder.java 17411 2017-04-28 14:50:38Z colin $
- Author:
- tlerios@marketcetera.com
-
-
Field Summary
Fields Modifier and Type Field Description private StatelessClientContextmCreationContextprivate longmLastAccessprivate TmSessionprivate StringmUser
-
Constructor Summary
Constructors Constructor Description SessionHolder(String user, StatelessClientContext creationContext)Creates a new holder with the given authenticated user name and creation context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StatelessClientContextgetCreationContext()Returns the receiver's creation context.(package private) longgetLastAccess()Returns the receiver's most recent access timestamp.TgetSession()Returns the receiver's session data.StringgetUser()Returns the receiver's user.(package private) voidmarkAccess()Sets the receiver's most recent access timestamp to the present time.voidsetSession(T session)Sets the receiver's session data to the given value.
-
-
-
Field Detail
-
mUser
private final String mUser
-
mCreationContext
private final StatelessClientContext mCreationContext
-
mLastAccess
private long mLastAccess
-
mSession
private T mSession
-
-
Constructor Detail
-
SessionHolder
public SessionHolder(String user, StatelessClientContext creationContext)
Creates a new holder with the given authenticated user name and creation context.- Parameters:
user- The user name.creationContext- The context.
-
-
Method Detail
-
getUser
public String getUser()
Returns the receiver's user.- Returns:
- The user.
-
getCreationContext
public StatelessClientContext getCreationContext()
Returns the receiver's creation context.- Returns:
- The context.
-
markAccess
void markAccess()
Sets the receiver's most recent access timestamp to the present time.
-
getLastAccess
long getLastAccess()
Returns the receiver's most recent access timestamp.- Returns:
- The timestamp.
-
setSession
public void setSession(T session)
Sets the receiver's session data to the given value.- Parameters:
session- The data, which may be null.
-
getSession
public T getSession()
Returns the receiver's session data.- Returns:
- The data, which may be null.
-
-