Interface BackendConnector
- All Known Implementing Classes:
HazelcastConnector,RedisConnector
Implementations of this interface provide the underlying storage mechanism for persisting serialized Vaadin session data. The interface supports both session data storage and coordination mechanisms to track the serialization lifecycle.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteSession(String clusterKey) Removes session data from the backend storage.getSession(String clusterKey) Retrieves session data from the backend storage by cluster key.voidmarkDeserializationComplete(String clusterKey) Marks the successful completion of the deserialization process for a session.voidmarkDeserializationFailed(String clusterKey, Throwable error) Marks the deserialization process as failed for a session.booleanmarkDeserializationStarted(String clusterKey, Duration timeToLive) Marks the beginning of the deserialization process for a session.voidmarkSerializationComplete(String clusterKey) Marks the successful completion of the serialization process for a session.voidmarkSerializationFailed(String clusterKey, Throwable error) Marks the serialization process as failed for a session.voidmarkSerializationStarted(String clusterKey, Duration timeToLive) Marks the beginning of the serialization process for a session.voidsendSession(SessionInfo sessionInfo) Stores serialized session data in the backend storage.
-
Method Details
-
sendSession
Stores serialized session data in the backend storage.- Parameters:
sessionInfo- the session information containing the cluster key, serialized data, and time-to-live settings.
-
getSession
Retrieves session data from the backend storage by cluster key.- Parameters:
clusterKey- the distributed storage key identifying the session.- Returns:
- the session information containing the serialized data, or
nullif no session is found for the given key.
-
deleteSession
Removes session data from the backend storage.- Parameters:
clusterKey- the distributed storage key identifying the session to delete.
-
markSerializationStarted
Marks the beginning of the serialization process for a session.This method is used for coordination between multiple requests to indicate that serialization is in progress and prevent concurrent access issues. Implementors can decide if the method should block in case of concurrent requests; potential acquired locks should be released in
markSerializationComplete(String)andmarkSerializationFailed(String, Throwable)methods.- Parameters:
clusterKey- the distributed storage key identifying the session.timeToLive- the maximum amount of time the serialization marker should be preserved in the backend. A zero or negative value means the marker should not be evicted.
-
markSerializationComplete
Marks the successful completion of the serialization process for a session.This method is called after session data has been successfully serialized and stored in the backend. Any lock has been acquired by
markSerializationStarted(String, Duration)should be released here.- Parameters:
clusterKey- the distributed storage key identifying the session.
-
markSerializationFailed
Marks the serialization process as failed for a session.This method is called when an error occurs during the serialization process to record the failure and its cause. Any lock has been acquired by
markSerializationStarted(String, Duration)should be released here.- Parameters:
clusterKey- the distributed storage key identifying the session.error- the error that caused the serialization to fail.
-
markDeserializationStarted
Marks the beginning of the deserialization process for a session.This method is used for coordination between multiple requests to indicate that serialization is in progress and prevent concurrent access issues. Implementors can decide if the method should block in case of concurrent requests; potential acquired locks should be released in
markDeserializationComplete(String)andmarkDeserializationFailed(String, Throwable)methods.- Parameters:
clusterKey- the distributed storage key identifying the session.timeToLive- the maximum amount of time the serialization marker should be preserved in the backend. A zero or negative value means the marker should not be evicted.- Returns:
- true if there is no pending deserialization process, otherwise false.
-
markDeserializationComplete
Marks the successful completion of the deserialization process for a session.This method is called after session data has been successfully deserialized. Any lock that has been acquired by
markDeserializationStarted(String, Duration)should be released here.- Parameters:
clusterKey- the distributed storage key identifying the session.
-
markDeserializationFailed
Marks the deserialization process as failed for a session.This method is called when an error occurs during the serialization process to record the failure and its cause. Any lock that has been acquired by
markDeserializationStarted(String, Duration)should be released here.- Parameters:
clusterKey- the distributed storage key identifying the session.error- the error that caused the serialization to fail.
-