Package com.google.longrunning.stub
Class GrpcOperationsStub
- java.lang.Object
-
- com.google.longrunning.stub.OperationsStub
-
- com.google.longrunning.stub.GrpcOperationsStub
-
- All Implemented Interfaces:
BackgroundResource
,java.lang.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 protected
GrpcOperationsStub(OperationsStubSettings settings, ClientContext clientContext)
Constructs an instance of GrpcOperationsStub, using the given settings.protected
GrpcOperationsStub(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 boolean
awaitTermination(long duration, java.util.concurrent.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()
void
close()
static GrpcOperationsStub
create(ClientContext clientContext)
static GrpcOperationsStub
create(ClientContext clientContext, GrpcStubCallableFactory callableFactory)
static GrpcOperationsStub
create(OperationsStubSettings settings)
UnaryCallable<com.google.longrunning.DeleteOperationRequest,com.google.protobuf.Empty>
deleteOperationCallable()
UnaryCallable<com.google.longrunning.GetOperationRequest,com.google.longrunning.Operation>
getOperationCallable()
boolean
isShutdown()
Returns true if this background resource has been shut down.boolean
isTerminated()
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()
void
shutdown()
Initiates an orderly shutdown in which previously submitted work is finished, but no new work will be accepted.void
shutdownNow()
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 java.io.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:
java.io.IOException
-
GrpcOperationsStub
protected GrpcOperationsStub(OperationsStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws java.io.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:
java.io.IOException
-
-
Method Detail
-
create
public static final GrpcOperationsStub create(OperationsStubSettings settings) throws java.io.IOException
- Throws:
java.io.IOException
-
create
public static final GrpcOperationsStub create(ClientContext clientContext) throws java.io.IOException
- Throws:
java.io.IOException
-
create
public static final GrpcOperationsStub create(ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws java.io.IOException
- Throws:
java.io.IOException
-
getOperationCallable
public UnaryCallable<com.google.longrunning.GetOperationRequest,com.google.longrunning.Operation> getOperationCallable()
- Overrides:
getOperationCallable
in classOperationsStub
-
listOperationsPagedCallable
public UnaryCallable<com.google.longrunning.ListOperationsRequest,OperationsClient.ListOperationsPagedResponse> listOperationsPagedCallable()
- Overrides:
listOperationsPagedCallable
in classOperationsStub
-
listOperationsCallable
public UnaryCallable<com.google.longrunning.ListOperationsRequest,com.google.longrunning.ListOperationsResponse> listOperationsCallable()
- Overrides:
listOperationsCallable
in classOperationsStub
-
cancelOperationCallable
public UnaryCallable<com.google.longrunning.CancelOperationRequest,com.google.protobuf.Empty> cancelOperationCallable()
- Overrides:
cancelOperationCallable
in classOperationsStub
-
deleteOperationCallable
public UnaryCallable<com.google.longrunning.DeleteOperationRequest,com.google.protobuf.Empty> deleteOperationCallable()
- Overrides:
deleteOperationCallable
in classOperationsStub
-
waitOperationCallable
public UnaryCallable<com.google.longrunning.WaitOperationRequest,com.google.longrunning.Operation> waitOperationCallable()
- Overrides:
waitOperationCallable
in classOperationsStub
-
close
public final void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in classOperationsStub
-
shutdown
public void shutdown()
Description copied from interface:BackgroundResource
Initiates 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:BackgroundResource
Returns true if this background resource has been shut down.
-
isTerminated
public boolean isTerminated()
Description copied from interface:BackgroundResource
Returns 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:BackgroundResource
Attempts 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, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
Description copied from interface:BackgroundResource
Blocks until all work has completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.- Throws:
java.lang.InterruptedException
-
-