Class DeltaRequest
java.lang.Object
org.apache.catalina.ha.session.DeltaRequest
- All Implemented Interfaces:
Externalizable, Serializable
This class is used to track the series of actions that happens when a request is executed. These actions will then
translate into invocations of methods on the actual session.
This class is NOT thread safe. One DeltaRequest per session.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAction to remove a value.static final intAction to set a value.static final LogThe logger for this class.static final StringName used for auth type actions.static final StringName used for new flag actions.static final StringName used for listener actions.static final StringName used for max inactive interval actions.static final StringName used for principal actions.protected static final StringManagerThe string manager for this package.static final intAction type for session attributes.static final intAction type for session authentication type.static final intAction type for session new flag.static final intAction type for session listener.static final intAction type for session max inactive interval.static final intAction type for session note.static final intAction type for session principal. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor required byExternalizable.DeltaRequest(String sessionId, boolean recordAllActions) Construct a new DeltaRequest. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdd an action to the list of actions to be executed.voidaddSessionListener(SessionListener listener) Record an add session listener action.voidclear()Clear all actions and the action pool.voidexecute(DeltaSession session, boolean notifyListeners) Execute all recorded actions on the given session.Get the session identifier.intgetSize()Get the number of actions recorded.voidvoidremoveAttribute(String name) Record a remove attribute action.voidremoveNote(String name) Record a remove note action.voidremoveSessionListener(SessionListener listener) Record a remove session listener action.voidreset()Reset this request, returning all action objects to the pool.protected byte[]serialize DeltaRequestvoidsetAttribute(String name, Object value) Record a set attribute action.voidsetAuthType(String authType) Record a set auth type action.voidsetMaxInactiveInterval(int interval) Record a set max inactive interval action.voidsetNew(boolean n) Record a set new action.voidRecord a set note action.voidOnly support principals from typeGenericPrincipalvoidsetSessionId(String sessionId) Set the session identifier.void
-
Field Details
-
log
The logger for this class. -
sm
The string manager for this package. -
TYPE_ATTRIBUTE
public static final int TYPE_ATTRIBUTEAction type for session attributes.- See Also:
-
TYPE_PRINCIPAL
public static final int TYPE_PRINCIPALAction type for session principal.- See Also:
-
TYPE_ISNEW
public static final int TYPE_ISNEWAction type for session new flag.- See Also:
-
TYPE_MAXINTERVAL
public static final int TYPE_MAXINTERVALAction type for session max inactive interval.- See Also:
-
TYPE_AUTHTYPE
public static final int TYPE_AUTHTYPEAction type for session authentication type.- See Also:
-
TYPE_LISTENER
public static final int TYPE_LISTENERAction type for session listener.- See Also:
-
TYPE_NOTE
public static final int TYPE_NOTEAction type for session note.- See Also:
-
ACTION_SET
public static final int ACTION_SETAction to set a value.- See Also:
-
ACTION_REMOVE
public static final int ACTION_REMOVEAction to remove a value.- See Also:
-
NAME_PRINCIPAL
-
NAME_MAXINTERVAL
-
NAME_ISNEW
-
NAME_AUTHTYPE
-
NAME_LISTENER
-
-
Constructor Details
-
DeltaRequest
public DeltaRequest()Default constructor required byExternalizable. -
DeltaRequest
Construct a new DeltaRequest.- Parameters:
sessionId- Session identifierrecordAllActions- Record all actions, including duplicates
-
-
Method Details
-
setAttribute
-
removeAttribute
Record a remove attribute action.- Parameters:
name- Attribute name
-
setNote
-
removeNote
-
setMaxInactiveInterval
public void setMaxInactiveInterval(int interval) Record a set max inactive interval action.- Parameters:
interval- Max inactive interval in seconds
-
setPrincipal
Only support principals from typeGenericPrincipal- Parameters:
p- Session principal- See Also:
-
setNew
public void setNew(boolean n) Record a set new action.- Parameters:
n- New flag value
-
setAuthType
Record a set auth type action.- Parameters:
authType- Authentication type
-
addSessionListener
Record an add session listener action.- Parameters:
listener- Session listener to add
-
removeSessionListener
Record a remove session listener action.- Parameters:
listener- Session listener to remove
-
addAction
-
execute
Execute all recorded actions on the given session.- Parameters:
session- Target sessionnotifyListeners- Whether to notify session listeners
-
reset
public void reset()Reset this request, returning all action objects to the pool. -
getSessionId
-
setSessionId
Set the session identifier.- Parameters:
sessionId- Session identifier
-
getSize
public int getSize()Get the number of actions recorded.- Returns:
- Number of actions
-
clear
public void clear()Clear all actions and the action pool. -
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
serialize
serialize DeltaRequest- Returns:
- serialized delta request
- Throws:
IOException- IO error serializing- See Also:
-