Class ClusteredSessionImpl
java.lang.Object
org.apache.tapestry5.http.internal.services.SessionImpl
org.apache.tapestry5.http.internal.services.ClusteredSessionImpl
- All Implemented Interfaces:
Session
A thin wrapper around
HttpSession
that supports re-storing of mutable
session attributes at the end of the request (see restoreDirtyObjects()
). This is only
used when clustering.- Since:
- 5.3
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.tapestry5.http.services.Session
Session.LockMode
-
Constructor Summary
ConstructorsConstructorDescriptionClusteredSessionImpl
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpSession session, SessionLock lock, SessionPersistedObjectAnalyzer analyzer) -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(String name) Returns the value previously stored in the session.void
Invalidates this session then unbinds any objects bound to it.void
Re-stores dirty objects back into the session.void
setAttribute
(String name, Object value) Sets the value of an attribute.Methods inherited from class org.apache.tapestry5.http.internal.services.SessionImpl
containsAttribute, containsAttribute, getAttribute, getAttributeNames, getAttributeNames, getAttributeNames, getAttributeNames, getMaxInactiveInterval, isInvalidated, setMaxInactiveInterval
-
Constructor Details
-
ClusteredSessionImpl
public ClusteredSessionImpl(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpSession session, SessionLock lock, SessionPersistedObjectAnalyzer analyzer)
-
-
Method Details
-
getAttribute
Description copied from interface:Session
Returns the value previously stored in the session.By default, a
WRITE
lock is requested.- Specified by:
getAttribute
in interfaceSession
- Overrides:
getAttribute
in classSessionImpl
- Parameters:
name
- The name of the attribute
-
setAttribute
Description copied from interface:Session
Sets the value of an attribute. If the value isnull
, then the attribute is deleted.- Specified by:
setAttribute
in interfaceSession
- Overrides:
setAttribute
in classSessionImpl
- Parameters:
name
- The name of the attributevalue
- The new value of the attribute;null
deletes the attribute.
-
invalidate
Description copied from interface:Session
Invalidates this session then unbinds any objects bound to it.- Specified by:
invalidate
in interfaceSession
- Overrides:
invalidate
in classSessionImpl
-
restoreDirtyObjects
Description copied from interface:Session
Re-stores dirty objects back into the session. This is necessary to support clustering, because (in most application servers) session objects are only broadcast around the cluster from setAttribute(). If a mutable session object is read and changed, those changes will be limited to a single server in the cluster, which can cause confusing application failures in the event of a failover. Does nothing if there are no changes, or the session has been invalidated.- Specified by:
restoreDirtyObjects
in interfaceSession
- Overrides:
restoreDirtyObjects
in classSessionImpl
- See Also:
-