public class SessionState extends Object
The session lifecycle is pretty simple: there are only two lifecycle states, "alive" and "closed", and only one possible state transition, from "alive" to "closed".
Concurrent access to session internals is controlled by the
perform(SessionOperation) method that guarantees that no two
operations are performed concurrently on the
|Constructor and Description|
Creates a state instance for a session.
|Modifier and Type||Method and Description|
Throws an exception if this session is not alive.
Closes this session.
Checks whether this session is alive.
Performs the given operation within a synchronized block.
public SessionState(SessionContext context)
context- component context of this session
public boolean isAlive()
SessionOperation, as otherwise there's no guarantee against another thread closing the session right after this method has returned.
trueif the session is alive,
public void checkAlive() throws RepositoryException
RepositoryException- throw if this session is not alive
public <T> T perform(SessionOperation<T> operation) throws RepositoryException
operation- session operation
RepositoryException- if the operation fails or if the session has already been closed
public boolean close()
trueif the session was closed, or
falseif the session had already been closed
Copyright © 2004–2023 The Apache Software Foundation. All rights reserved.