Class SessionState.ExportBuilder<T>

java.lang.Object
io.deephaven.server.session.SessionState.ExportBuilder<T>
Enclosing class:
SessionState

public class SessionState.ExportBuilder<T> extends Object
  • Method Details

    • queryPerformanceRecorder

      public SessionState.ExportBuilder<T> queryPerformanceRecorder(@NotNull @NotNull QueryPerformanceRecorder queryPerformanceRecorder)
      Set the performance recorder to resume when running this export.
      Parameters:
      queryPerformanceRecorder - the performance recorder
      Returns:
      this builder
    • requiresSerialQueue

      public SessionState.ExportBuilder<T> requiresSerialQueue()
      Some exports must happen serially w.r.t. other exports. For example, an export that acquires the exclusive UGP lock. We enqueue these dependencies independently of the otherwise regularly concurrent exports.
      Returns:
      this builder
    • require

      public SessionState.ExportBuilder<T> require(SessionState.ExportObject<?>... dependencies)
      Invoke this method to set the required dependencies for this export. A parent may be null to simplify usage of optional export dependencies.
      Parameters:
      dependencies - the parent dependencies
      Returns:
      this builder
    • require

      public SessionState.ExportBuilder<T> require(List<? extends SessionState.ExportObject<?>> dependencies)
      Invoke this method to set the required dependencies for this export. A parent may be null to simplify usage of optional export dependencies.
      Parameters:
      dependencies - the parent dependencies
      Returns:
      this builder
    • onError

      Invoke this method to set the error handler to be notified if this export fails. Only one error handler may be set. Exactly one of the onError and onSuccess handlers will be invoked.

      Not synchronized, it is expected that the provided callback handles thread safety itself.

      Parameters:
      errorHandler - the error handler to be notified
      Returns:
      this builder
    • onErrorHandler

      public SessionState.ExportBuilder<T> onErrorHandler(SessionState.ExportErrorGrpcHandler errorHandler)
      Invoke this method to set the error handler to be notified if this export fails. Only one error handler may be set. Exactly one of the onError and onSuccess handlers will be invoked.

      Not synchronized, it is expected that the provided callback handles thread safety itself.

      Parameters:
      errorHandler - the error handler to be notified
      Returns:
      this builder
    • onError

      public SessionState.ExportBuilder<T> onError(io.grpc.stub.StreamObserver<?> streamObserver)
      Invoke this method to set the error handler to be notified if this export fails. Only one error handler may be set. This is a convenience method for use with StreamObserver. Exactly one of the onError and onSuccess handlers will be invoked.

      Invoking onError will be synchronized on the StreamObserver instance, so callers can rely on that mechanism to deal with more than one thread trying to write to the stream.

      Parameters:
      streamObserver - the streamObserver to be notified of any error
      Returns:
      this builder
    • onSuccess

      public SessionState.ExportBuilder<T> onSuccess(Consumer<? super T> successHandler)
      Invoke this method to set the onSuccess handler to be notified if this export succeeds. Only one success handler may be set. Exactly one of the onError and onSuccess handlers will be invoked.

      Not synchronized, it is expected that the provided callback handles thread safety itself.

      Parameters:
      successHandler - the onSuccess handler to be notified
      Returns:
      this builder
    • onSuccess

      public SessionState.ExportBuilder<T> onSuccess(Runnable successHandler)
      Invoke this method to set the onSuccess handler to be notified if this export succeeds. Only one success handler may be set. Exactly one of the onError and onSuccess handlers will be invoked.

      Not synchronized, it is expected that the provided callback handles thread safety itself.

      Parameters:
      successHandler - the onSuccess handler to be notified
      Returns:
      this builder
    • submit

      public SessionState.ExportObject<T> submit(Callable<T> exportMain)
      This method is the final method for submitting an export to the session. The provided callable is enqueued on the scheduler when all dependencies have been satisfied. Only the dependencies supplied to the builder are guaranteed to be resolved when the exportMain is executing.

      Warning! It is the SessionState owner's responsibility to wait to release any dependency until after this exportMain callable/runnable has complete.

      Parameters:
      exportMain - the callable that generates the export
      Returns:
      the submitted export object
    • submit

      public SessionState.ExportObject<T> submit(Runnable exportMain)
      This method is the final method for submitting an export to the session. The provided runnable is enqueued on the scheduler when all dependencies have been satisfied. Only the dependencies supplied to the builder are guaranteed to be resolved when the exportMain is executing.

      Warning! It is the SessionState owner's responsibility to wait to release any dependency until after this exportMain callable/runnable has complete.

      Parameters:
      exportMain - the runnable to execute once dependencies have resolved
      Returns:
      the submitted export object
    • getExport

      public SessionState.ExportObject<T> getExport()
      Returns:
      the export object that this builder is building
    • getExportId

      public int getExportId()
      Returns:
      the export id of this export or SessionState.NON_EXPORT_ID if is a non-export