Class SessionState.ExportObject<T>

Type Parameters:
T - Is context-sensitive depending on the export.
All Implemented Interfaces:
LogOutputAppendable, LivenessManager, LivenessNode, LivenessReferent, Serializable
Enclosing class:
SessionState

public static final class SessionState.ExportObject<T> extends LivenessArtifact
This class represents one unit of content exported in the session.

Note: we reuse ExportObject for non-exporting tasks that have export dependencies.

See Also:
ApiNote:
ExportId may be 0, if this is a task that has exported dependencies, but does not export anything itself. Non-exports do not publish state changes.
  • Method Details

    • isNonExport

      public boolean isNonExport()
      Returns:
      if this export is a session-less non-export
    • get

      public T get()
      WARNING! This method call is only safe to use in the following patterns:

      1) If an export (or non-export) SessionState.ExportBuilder.require(io.deephaven.server.session.SessionState.ExportObject<?>...)'d this export then the method is valid from within the Callable/Runnable passed to SessionState.ExportBuilder.submit(java.util.concurrent.Callable<T>).

      2) By first obtaining a reference to the SessionState.ExportObject, and then observing its state as ExportNotification.State.EXPORTED. The caller must abide by the Liveness API and dropReference.

      Example:

       
       <T> T getFromExport(ExportObject<T> export) {
           if (export.tryRetainReference()) {
               try {
                   if (export.getState() == ExportNotification.State.EXPORTED) {
                       return export.get();
                   }
               } finally {
                   export.dropReference();
               }
           }
           return null;
       }
       
       
      Returns:
      the result of the computed export
    • getState

      public ExportNotification.State getState()
      Returns:
      the current state of this export
    • getExportId

      public Ticket getExportId()
      Returns:
      the ticket for this export; note if this is a non-export the returned ticket will not resolve to anything and is considered an invalid ticket
    • release

      public void release()
      Releases this export; it will wait for the work to complete before releasing.
    • cancel

      public void cancel()
      Releases this export; it will cancel the work and dependent exports proactively when possible.
    • destroy

      protected void destroy()
      Description copied from class: ReferenceCountedLivenessReferent
      Attempt to release (destructively when necessary) resources held by this object. This may render the object unusable for subsequent operations. Implementations should be sure to call super.destroy().

      This is intended to only ever be used as a side effect of decreasing the reference count to 0.

      Overrides:
      destroy in class ReferenceCountedLivenessReferent