Class OOBSession<C,B extends org.wildfly.clustering.cache.batch.Batch>

java.lang.Object
org.wildfly.clustering.session.OOBSession<C,B>
Type Parameters:
C - the session context
B - the batch type
All Implemented Interfaces:
AutoCloseable, Expiration, ExpirationMetaData, org.wildfly.clustering.server.Registration, ImmutableSession, ImmutableSessionAttributes, ImmutableSessionMetaData, Session<C>, SessionAttributes, SessionMetaData

public class OOBSession<C,B extends org.wildfly.clustering.cache.batch.Batch> extends Object implements Session<C>, SessionMetaData, SessionAttributes
Out-of-band session implementation, for use outside the context of a request.
Author:
Paul Ferraro
  • Constructor Details

  • Method Details

    • getId

      public String getId()
      Description copied from interface: ImmutableSession
      Specifies this session's unique identifier.
      Specified by:
      getId in interface ImmutableSession
      Returns:
      a unique identifier for this session.
    • getMetaData

      public SessionMetaData getMetaData()
      Description copied from interface: ImmutableSession
      Returns this session's meta data.
      Specified by:
      getMetaData in interface ImmutableSession
      Specified by:
      getMetaData in interface Session<C>
      Returns:
      this session's meta data
    • getAttributes

      public SessionAttributes getAttributes()
      Description copied from interface: ImmutableSession
      Returns this session's attributes.
      Specified by:
      getAttributes in interface ImmutableSession
      Specified by:
      getAttributes in interface Session<C>
      Returns:
      this session's attributes
    • getContext

      public C getContext()
      Description copied from interface: Session
      Returns the local context of this session. The local context is *not* replicated to other nodes in the cluster.
      Specified by:
      getContext in interface Session<C>
      Returns:
      a local context
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.wildfly.clustering.server.Registration
    • isNew

      public boolean isNew()
      Description copied from interface: ImmutableSessionMetaData
      Indicates whether or not this session was created by the current thread.
      Specified by:
      isNew in interface ImmutableSessionMetaData
      Returns:
      true, if this session is new, false otherwise
    • isValid

      public boolean isValid()
      Description copied from interface: ImmutableSession
      Indicates whether or not this session is valid.
      Specified by:
      isValid in interface ImmutableSession
      Returns:
      true, if this session is valid, false otherwise
    • invalidate

      public void invalidate()
      Description copied from interface: Session
      Invalidates this session.
      Specified by:
      invalidate in interface Session<C>
    • isExpired

      public boolean isExpired()
      Specified by:
      isExpired in interface ExpirationMetaData
    • getCreationTime

      public Instant getCreationTime()
      Description copied from interface: ImmutableSessionMetaData
      Returns the time this session was created.
      Specified by:
      getCreationTime in interface ImmutableSessionMetaData
      Returns:
      the time this session was created
    • getLastAccessStartTime

      public Instant getLastAccessStartTime()
      Description copied from interface: ImmutableSessionMetaData
      Returns the start time of the last request to access this session, or null if session was created during the current request.
      Specified by:
      getLastAccessStartTime in interface ImmutableSessionMetaData
      Returns:
      the start time of the last request to access this session, or null if session was created during the current request.
    • getLastAccessEndTime

      public Instant getLastAccessEndTime()
      Description copied from interface: ImmutableSessionMetaData
      Returns the end time of the last request to access this session, or null if session was created during the current request.
      Specified by:
      getLastAccessEndTime in interface ImmutableSessionMetaData
      Returns:
      the end time of the last request to access this session, or null if session was created during the current request.
    • getTimeout

      public Duration getTimeout()
      Specified by:
      getTimeout in interface Expiration
    • setLastAccess

      public void setLastAccess(Instant startTime, Instant endTime)
      Description copied from interface: SessionMetaData
      Sets the time this session was last accessed.
      Specified by:
      setLastAccess in interface SessionMetaData
    • setTimeout

      public void setTimeout(Duration duration)
      Description copied from interface: SessionMetaData
      Set the time interval as a duration, after which this session will expire.
      Specified by:
      setTimeout in interface SessionMetaData
      Parameters:
      duration - a time duration
    • getAttributeNames

      public Set<String> getAttributeNames()
      Description copied from interface: ImmutableSessionAttributes
      Returns the names of the attributes of this session.
      Specified by:
      getAttributeNames in interface ImmutableSessionAttributes
      Returns:
      a set of unique attribute names
    • getAttribute

      public Object getAttribute(String name)
      Description copied from interface: ImmutableSessionAttributes
      Retrieves the value of the specified attribute.
      Specified by:
      getAttribute in interface ImmutableSessionAttributes
      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: SessionAttributes
      Removes the specified attribute.
      Specified by:
      removeAttribute in interface SessionAttributes
      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: SessionAttributes
      Sets the specified attribute to the specified value.
      Specified by:
      setAttribute in interface SessionAttributes
      Parameters:
      name - a unique attribute name
      value - the attribute value
      Returns:
      the old attribute value, or null if the attribute did not previously exist.