Package org.simpleframework.xml.core
Class SessionManager.Reference
java.lang.Object
org.simpleframework.xml.core.SessionManager.Reference
- Enclosing class:
SessionManager
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 -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
session
This is the session object that is maintained by this. -
count
private int countThis is the count of the number of references to this.
-
-
Constructor Details
-
Reference
public Reference(boolean strict) Constructor for theReference
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
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
-