Class SessionManager.Reference

java.lang.Object
org.simpleframework.xml.core.SessionManager.Reference
Enclosing class:
SessionManager

private static class SessionManager.Reference extends Object
The Reference object is used to store sessions and count references to them. Counting references ensures that no session is closed or disposed of until all references to it have been removed. Once references are removed the session is discarded and can no longer be acquired.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
    This is the count of the number of references to this.
    private Session
    This is the session object that is maintained by this.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Reference(boolean strict)
    Constructor for the Reference object.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    This is used to clear the references to the session.
    get()
    This is used to acquire the session and increase the count of references to the session.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • session

      private Session session
      This is the session object that is maintained by this.
    • count

      private int count
      This is the count of the number of references to this.
  • Constructor Details

    • Reference

      public Reference(boolean strict)
      Constructor for the Reference object. This is used during the serialization process to manage references to the sessions that are used by the serializer.
      Parameters:
      strict - determines whether the session is strict
  • Method Details

    • get

      public Session get()
      This is used to acquire the session and increase the count of references to the session. When the references are all cleared then the reference counter can no longer be increased and the reference should be discarded.
      Returns:
      this returns the session for this reference
    • clear

      public int clear()
      This is used to clear the references to the session. A reference is cleared when it is closed from the manager. The reference is disposed of when this returns zero or a negative number indicating all references are gone.
      Returns:
      this returns the number of references this has