Interface RepositorySystemSession.CloseableSession

All Superinterfaces:
AutoCloseable, Closeable, RepositorySystemSession
All Known Implementing Classes:
DefaultCloseableSession
Enclosing interface:
RepositorySystemSession

Immutable session that is closeable, should be handled as a resource. These session instances can be created with RepositorySystemSession.SessionBuilder.
Since:
2.0.0
Restriction:
This interface is not intended to be extended by clients.
Restriction:
This interface is not intended to be implemented by clients.
  • Method Details

    • sessionId

      Returns the ID of this closeable session instance. Each closeable session has different ID, unique within repository system they were created with.
      Returns:
      The session ID that is never null.
    • copy

      Copies this session into a pre-populated builder, effectively making a mutable copy of itself, builder builds same session. Important: this session remains unchanged upon return of this method but this session and returned builder created session will have same identity. It is up to client code, will it close only the original (this) session or new session, or both. Important is, that at least one of the sessions must be closed, and consequence is that once either one is closed, the other session is closed as well.

      This pattern should be applied in "filter" like constructs, when code needs to alter the incoming session and subsequently pass it downstream.

    • close

      void close()
      Closes the session. The session should be closed by its creator. A closed session should not be used anymore. This method may be invoked multiple times, but close will act only once (first time).
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable