Package com.google.longrunning.stub
Class GrpcOperationsStub
- java.lang.Object
-
- com.google.longrunning.stub.OperationsStub
-
- com.google.longrunning.stub.GrpcOperationsStub
-
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
public class GrpcOperationsStub extends OperationsStub
gRPC stub implementation for Google Long Running Operations API.This class is for advanced usage and reflects the underlying API directly.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGrpcOperationsStub(OperationsStubSettings settings, ClientContext clientContext)Constructs an instance of GrpcOperationsStub, using the given settings.protectedGrpcOperationsStub(OperationsStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory)Constructs an instance of GrpcOperationsStub, using the given settings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitTermination(long duration, TimeUnit unit)Blocks until all work has completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.UnaryCallable<com.google.longrunning.CancelOperationRequest,com.google.protobuf.Empty>cancelOperationCallable()voidclose()static GrpcOperationsStubcreate(ClientContext clientContext)static GrpcOperationsStubcreate(ClientContext clientContext, GrpcStubCallableFactory callableFactory)static GrpcOperationsStubcreate(OperationsStubSettings settings)UnaryCallable<com.google.longrunning.DeleteOperationRequest,com.google.protobuf.Empty>deleteOperationCallable()UnaryCallable<com.google.longrunning.GetOperationRequest,com.google.longrunning.Operation>getOperationCallable()booleanisShutdown()Returns true if this background resource has been shut down.booleanisTerminated()Returns true if all work has completed following shut down.UnaryCallable<com.google.longrunning.ListOperationsRequest,com.google.longrunning.ListOperationsResponse>listOperationsCallable()UnaryCallable<com.google.longrunning.ListOperationsRequest,OperationsClient.ListOperationsPagedResponse>listOperationsPagedCallable()voidshutdown()Initiates an orderly shutdown in which previously submitted work is finished, but no new work will be accepted.voidshutdownNow()Attempts to stop all actively executing work and halts the processing of waiting work.UnaryCallable<com.google.longrunning.WaitOperationRequest,com.google.longrunning.Operation>waitOperationCallable()
-
-
-
Constructor Detail
-
GrpcOperationsStub
protected GrpcOperationsStub(OperationsStubSettings settings, ClientContext clientContext) throws IOException
Constructs an instance of GrpcOperationsStub, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
GrpcOperationsStub
protected GrpcOperationsStub(OperationsStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException
Constructs an instance of GrpcOperationsStub, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
-
Method Detail
-
create
public static final GrpcOperationsStub create(OperationsStubSettings settings) throws IOException
- Throws:
IOException
-
create
public static final GrpcOperationsStub create(ClientContext clientContext) throws IOException
- Throws:
IOException
-
create
public static final GrpcOperationsStub create(ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException
- Throws:
IOException
-
getOperationCallable
public UnaryCallable<com.google.longrunning.GetOperationRequest,com.google.longrunning.Operation> getOperationCallable()
- Overrides:
getOperationCallablein classOperationsStub
-
listOperationsPagedCallable
public UnaryCallable<com.google.longrunning.ListOperationsRequest,OperationsClient.ListOperationsPagedResponse> listOperationsPagedCallable()
- Overrides:
listOperationsPagedCallablein classOperationsStub
-
listOperationsCallable
public UnaryCallable<com.google.longrunning.ListOperationsRequest,com.google.longrunning.ListOperationsResponse> listOperationsCallable()
- Overrides:
listOperationsCallablein classOperationsStub
-
cancelOperationCallable
public UnaryCallable<com.google.longrunning.CancelOperationRequest,com.google.protobuf.Empty> cancelOperationCallable()
- Overrides:
cancelOperationCallablein classOperationsStub
-
deleteOperationCallable
public UnaryCallable<com.google.longrunning.DeleteOperationRequest,com.google.protobuf.Empty> deleteOperationCallable()
- Overrides:
deleteOperationCallablein classOperationsStub
-
waitOperationCallable
public UnaryCallable<com.google.longrunning.WaitOperationRequest,com.google.longrunning.Operation> waitOperationCallable()
- Overrides:
waitOperationCallablein classOperationsStub
-
close
public final void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classOperationsStub
-
shutdown
public void shutdown()
Description copied from interface:BackgroundResourceInitiates an orderly shutdown in which previously submitted work is finished, but no new work will be accepted. Invocation has no additional effect if already shut down.This method does not wait for previously submitted work to complete execution. Use awaitTermination to do that.
-
isShutdown
public boolean isShutdown()
Description copied from interface:BackgroundResourceReturns true if this background resource has been shut down.
-
isTerminated
public boolean isTerminated()
Description copied from interface:BackgroundResourceReturns true if all work has completed following shut down. Note that isTerminated is never true unless either shutdown or shutdownNow was called first.
-
shutdownNow
public void shutdownNow()
Description copied from interface:BackgroundResourceAttempts to stop all actively executing work and halts the processing of waiting work.This method does not wait for actively executing work to terminate. Use awaitTermination to do that.
There are no guarantees beyond best-effort attempts to stop processing actively executing work. For example, typical implementations will cancel via Thread.interrupt(), so any task that fails to respond to interrupts may never terminate.
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedExceptionDescription copied from interface:BackgroundResourceBlocks until all work has completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.- Throws:
InterruptedException
-
-