Interface SessionData

  • All Known Implementing Classes:
    DefaultSessionData

    public interface SessionData
    A container for data that is specific to a repository system session. Both components within the repository system and clients of the system may use this storage to associate arbitrary data with a session.

    Unlike a cache, this session data is not subject to purging. For this same reason, session data should also not be abused as a cache (i.e. for storing values that can be re-calculated) to avoid memory exhaustion.

    Note: Actual implementations must be thread-safe.

    See Also:
    RepositorySystemSession.getData()
    Restriction:
    This interface is not intended to be extended by clients.
    Restriction:
    This interface is not intended to be implemented by clients.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Object get​(Object key)
      Gets the session data associated with the specified key.
      void set​(Object key, Object value)
      Associates the specified session data with the given key.
      boolean set​(Object key, Object oldValue, Object newValue)
      Associates the specified session data with the given key if the key is currently mapped to the given value.
    • Method Detail

      • set

        void set​(Object key,
                 Object value)
        Associates the specified session data with the given key.
        Parameters:
        key - The key under which to store the session data, must not be null.
        value - The data to associate with the key, may be null to remove the mapping.
      • set

        boolean set​(Object key,
                    Object oldValue,
                    Object newValue)
        Associates the specified session data with the given key if the key is currently mapped to the given value. This method provides an atomic compare-and-update of some key's value.
        Parameters:
        key - The key under which to store the session data, must not be null.
        oldValue - The expected data currently associated with the key, may be null.
        newValue - The data to associate with the key, may be null to remove the mapping.
        Returns:
        true if the key mapping was successfully updated from the old value to the new value, false if the current key mapping didn't match the expected value and was not updated.
      • get

        Object get​(Object key)
        Gets the session data associated with the specified key.
        Parameters:
        key - The key for which to retrieve the session data, must not be null.
        Returns:
        The session data associated with the key or null if none.