Class OOBSession<L,B extends Batch>
- java.lang.Object
-
- org.wildfly.clustering.web.session.oob.OOBSession<L,B>
-
- All Implemented Interfaces:
AutoCloseable,ImmutableSession,ImmutableSessionAttributes,ImmutableSessionMetaData,Session<L>,SessionAttributes,SessionExpirationMetaData,SessionMetaData
public class OOBSession<L,B extends Batch> extends Object implements Session<L>, SessionMetaData, SessionAttributes
Out-of-band session implementation, for use outside the context of a request.- Author:
- Paul Ferraro
-
-
Constructor Summary
Constructors Constructor Description OOBSession(SessionManager<L,B> manager, String id, L localContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Indicates that the application thread is finished with this session.ObjectgetAttribute(String name)Retrieves the value of the specified attribute.Set<String>getAttributeNames()Returns the names of the attributes of this session.SessionAttributesgetAttributes()Returns this session's attributes.InstantgetCreationTime()Returns the time this session was created.StringgetId()Specifies this session's unique identifier.InstantgetLastAccessEndTime()Returns the end time of the last request to access this session.InstantgetLastAccessStartTime()Returns the start time of the last request to access this session.LgetLocalContext()Returns the local context of this session.DurationgetMaxInactiveInterval()Returns the time interval sinceSessionExpirationMetaData.getLastAccessEndTime()after which this session will expire.SessionMetaDatagetMetaData()Returns this session's meta data.voidinvalidate()Invalidates this session.booleanisExpired()Indicates whether or not this session was previously idle for longer than the maximum inactive interval.booleanisNew()Indicates whether or not this session was created by the current thread.booleanisValid()Indicates whether or not this session is valid.ObjectremoveAttribute(String name)Removes the specified attribute.ObjectsetAttribute(String name, Object value)Sets the specified attribute to the specified value.voidsetLastAccess(Instant startTime, Instant endTime)Sets the time this session was last accessed.voidsetMaxInactiveInterval(Duration duration)Set the time interval as a duration, after which this session will expire.
-
-
-
Constructor Detail
-
OOBSession
public OOBSession(SessionManager<L,B> manager, String id, L localContext)
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:ImmutableSessionSpecifies this session's unique identifier.- Specified by:
getIdin interfaceImmutableSession- Returns:
- a unique identifier for this session.
-
isValid
public boolean isValid()
Description copied from interface:ImmutableSessionIndicates whether or not this session is valid.- Specified by:
isValidin interfaceImmutableSession- Returns:
- true, if this session is valid, false otherwise
-
getMetaData
public SessionMetaData getMetaData()
Description copied from interface:SessionReturns this session's meta data.- Specified by:
getMetaDatain interfaceImmutableSession- Specified by:
getMetaDatain interfaceSession<L>- Returns:
- this session's meta data
-
invalidate
public void invalidate()
Description copied from interface:SessionInvalidates this session.- Specified by:
invalidatein interfaceSession<L>
-
getAttributes
public SessionAttributes getAttributes()
Description copied from interface:SessionReturns this session's attributes.- Specified by:
getAttributesin interfaceImmutableSession- Specified by:
getAttributesin interfaceSession<L>- Returns:
- this session's attributes
-
getLocalContext
public L getLocalContext()
Description copied from interface:SessionReturns the local context of this session. The local context is *not* replicated to other nodes in the cluster.- Specified by:
getLocalContextin interfaceSession<L>- Returns:
- a local context
-
close
public void close()
Description copied from interface:SessionIndicates that the application thread is finished with this session. This method is intended to be invoked within the context of a batch.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSession<L>
-
isNew
public boolean isNew()
Description copied from interface:ImmutableSessionMetaDataIndicates whether or not this session was created by the current thread.- Specified by:
isNewin interfaceImmutableSessionMetaData- Returns:
- true, if this session is new, false otherwise
-
isExpired
public boolean isExpired()
Description copied from interface:SessionExpirationMetaDataIndicates whether or not this session was previously idle for longer than the maximum inactive interval.- Specified by:
isExpiredin interfaceSessionExpirationMetaData- Returns:
- true, if this session is expired, false otherwise
-
getCreationTime
public Instant getCreationTime()
Description copied from interface:ImmutableSessionMetaDataReturns the time this session was created.- Specified by:
getCreationTimein interfaceImmutableSessionMetaData- Returns:
- the time this session was created
-
getLastAccessStartTime
public Instant getLastAccessStartTime()
Description copied from interface:ImmutableSessionMetaDataReturns the start time of the last request to access this session.- Specified by:
getLastAccessStartTimein interfaceImmutableSessionMetaData- Returns:
- the start time of the last request to access this session.
-
getLastAccessEndTime
public Instant getLastAccessEndTime()
Description copied from interface:SessionExpirationMetaDataReturns the end time of the last request to access this session.- Specified by:
getLastAccessEndTimein interfaceSessionExpirationMetaData- Returns:
- the end time of the last request to access this session.
-
getMaxInactiveInterval
public Duration getMaxInactiveInterval()
Description copied from interface:SessionExpirationMetaDataReturns the time interval sinceSessionExpirationMetaData.getLastAccessEndTime()after which this session will expire.- Specified by:
getMaxInactiveIntervalin interfaceSessionExpirationMetaData- Returns:
- a time interval
-
setLastAccess
public void setLastAccess(Instant startTime, Instant endTime)
Description copied from interface:SessionMetaDataSets the time this session was last accessed.- Specified by:
setLastAccessin interfaceSessionMetaData
-
setMaxInactiveInterval
public void setMaxInactiveInterval(Duration duration)
Description copied from interface:SessionMetaDataSet the time interval as a duration, after which this session will expire.- Specified by:
setMaxInactiveIntervalin interfaceSessionMetaData- Parameters:
duration- a time duration
-
getAttributeNames
public Set<String> getAttributeNames()
Description copied from interface:ImmutableSessionAttributesReturns the names of the attributes of this session.- Specified by:
getAttributeNamesin interfaceImmutableSessionAttributes- Returns:
- a set of unique attribute names
-
getAttribute
public Object getAttribute(String name)
Description copied from interface:ImmutableSessionAttributesRetrieves the value of the specified attribute.- Specified by:
getAttributein interfaceImmutableSessionAttributes- Parameters:
name- a unique attribute name- Returns:
- the attribute value, or null if the attribute does not exist.
-
removeAttribute
public Object removeAttribute(String name)
Description copied from interface:SessionAttributesRemoves the specified attribute.- Specified by:
removeAttributein interfaceSessionAttributes- Parameters:
name- a unique attribute name- Returns:
- the removed attribute value, or null if the attribute does not exist.
-
setAttribute
public Object setAttribute(String name, Object value)
Description copied from interface:SessionAttributesSets the specified attribute to the specified value.- Specified by:
setAttributein interfaceSessionAttributes- Parameters:
name- a unique attribute namevalue- the attribute value- Returns:
- the old attribute value, or null if the attribute did not previously exist.
-
-