Class SessionState.ExportBuilder<T>
- Enclosing class:
- SessionState
-
Method Summary
Modifier and TypeMethodDescriptionint
onError
(SessionState.ExportErrorHandler errorHandler) Invoke this method to set the error handler to be notified if this export fails.onError
(io.grpc.stub.StreamObserver<?> streamObserver) Invoke this method to set the error handler to be notified if this export fails.onErrorHandler
(SessionState.ExportErrorGrpcHandler errorHandler) Invoke this method to set the error handler to be notified if this export fails.Invoke this method to set the onSuccess handler to be notified if this export succeeds.Invoke this method to set the onSuccess handler to be notified if this export succeeds.queryPerformanceRecorder
(@NotNull QueryPerformanceRecorder queryPerformanceRecorder) Set the performance recorder to resume when running this export.require
(SessionState.ExportObject<?>... dependencies) Invoke this method to set the required dependencies for this export.require
(List<? extends SessionState.ExportObject<?>> dependencies) Invoke this method to set the required dependencies for this export.Some exports must happen serially w.r.t.This method is the final method for submitting an export to the session.This method is the final method for submitting an export to the session.
-
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
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
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
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 withStreamObserver
. 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
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
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
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
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
- 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
-