- java.lang.Object
-
- org.tentackle.session.ThreadLocalSessionHolder
-
- All Implemented Interfaces:
java.io.Serializable,SessionHolder
public class ThreadLocalSessionHolder extends java.lang.Object implements SessionHolder
A session holder returning the thread-local session.
Nice if no domain context available, e.g. for low-level AbstractDbObjects.- Author:
- harald
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ThreadLocalSessionHolder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SessiongetSession()Gets the session.
The threadlocal session is returned if the session is null.SessionInfogetSessionInfo()The SessionInfo extends the UserInfo by a SecurityManager.intgetSessionInstanceNumber()Gets the unique instance number of the Session.booleanisSessionImmutable()Returns whether the session is immutable.booleanisSessionThreadLocal()Returns whether the session is thread local.voidsetSession(Session session)Sets the session.voidsetSessionImmutable(boolean sessionImmutable)Sets the session to immutable.
-
-
-
Method Detail
-
getSession
public Session getSession()
Description copied from interface:SessionHolderGets the session.
The threadlocal session is returned if the session is null.- Specified by:
getSessionin interfaceSessionHolder- Returns:
- the session.
-
setSession
public void setSession(Session session)
Description copied from interface:SessionHolderSets the session.- Specified by:
setSessionin interfaceSessionHolder- Parameters:
session- the session, null if threadlocal
-
isSessionThreadLocal
public boolean isSessionThreadLocal()
Description copied from interface:SessionHolderReturns whether the session is thread local.- Specified by:
isSessionThreadLocalin interfaceSessionHolder- Returns:
- true if threadlocal
-
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
public SessionInfo getSessionInfo()
Description copied from interface:SessionHolderThe SessionInfo extends the UserInfo by a SecurityManager.- Specified by:
getSessionInfoin interfaceSessionHolder- Returns:
- the SessionInfo associated to the Db.
-
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
-
-