java.lang.Object
org.tentackle.session.ThreadLocalSessionHolder
- All Implemented Interfaces:
Serializable,SessionHolder
A session holder returning the thread-local session.
Nice if no domain context available, e.g. for low-level AbstractDbObjects.
Nice if no domain context available, e.g. for low-level AbstractDbObjects.
- Author:
- harald
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the session.
The thread-local session is returned if the session is null.Gets the session info associated to the session.intGets the unique instance number of the Session.booleanReturns whether the session is immutable.booleanReturns whether the session is thread-local.voidsetSession(Session session) Sets the session.voidsetSessionImmutable(boolean sessionImmutable) Sets the session to immutable.
-
Constructor Details
-
ThreadLocalSessionHolder
public ThreadLocalSessionHolder()Creates a thread-local session holder.
-
-
Method Details
-
getSession
Description copied from interface:SessionHolderGets the session.
The thread-local session is returned if the session is null.- Specified by:
getSessionin interfaceSessionHolder- Returns:
- the session.
-
setSession
Description copied from interface:SessionHolderSets the session.- Specified by:
setSessionin interfaceSessionHolder- Parameters:
session- the session, null if thread-local
-
isSessionThreadLocal
public boolean isSessionThreadLocal()Description copied from interface:SessionHolderReturns whether the session is thread-local.- Specified by:
isSessionThreadLocalin interfaceSessionHolder- Returns:
- true if thread-local
-
setSessionImmutable
public void setSessionImmutable(boolean sessionImmutable) Description copied from interface:SessionHolderSets the session to immutable.- Specified by:
setSessionImmutablein interfaceSessionHolder- Parameters:
sessionImmutable- true if session cannot be changed anymore
-
isSessionImmutable
public boolean isSessionImmutable()Description copied from interface:SessionHolderReturns whether the session is immutable.- Specified by:
isSessionImmutablein interfaceSessionHolder- Returns:
- true if immutable
-
getSessionInfo
Description copied from interface:SessionHolderGets the session info associated to the session.- Specified by:
getSessionInfoin interfaceSessionHolder- Returns:
- the session info
-
getSessionInstanceNumber
public int getSessionInstanceNumber()Description copied from interface:SessionHolderGets the unique instance number of the Session.Delegating
getSession().getInstanceNumber()togetSessionInstanceNumberallows to override getSession and dynamically retrieve the thread's session without changing the sorting order.- Specified by:
getSessionInstanceNumberin interfaceSessionHolder- Returns:
- the session's instance number
-