Package com.google.cloud.spanner
Class Operation<R,M>
- java.lang.Object
-
- com.google.cloud.spanner.Operation<R,M>
-
public class Operation<R,M> extends Object
Represents a long running operation.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description M
getMetadata()
Returns the metadata returned by the last refresh of this operation.String
getName()
Returns the name of the operation.R
getResult()
Returns result of the operation if the operation is complete and had a result.boolean
isDone()
Returns true if the operation is done.boolean
isSuccessful()
Returns true if the operation completed successfully.Operation<R,M>
reload()
Fetches the current status of this operation.Operation<R,M>
waitFor(com.google.cloud.RetryOption... waitOptions)
Blocks till the operation is complete or maximum time, if specified, has elapsed.
-
-
-
Method Detail
-
reload
public Operation<R,M> reload() throws SpannerException
Fetches the current status of this operation.- Throws:
SpannerException
-
waitFor
public Operation<R,M> waitFor(com.google.cloud.RetryOption... waitOptions) throws SpannerException
Blocks till the operation is complete or maximum time, if specified, has elapsed.- Returns:
- null if operation is not found otherwise the current operation.
- Throws:
SpannerException
-
getMetadata
public M getMetadata()
Returns the metadata returned by the last refresh of this operation. Returns null if no metadata was returned or if this operation has not been refreshed.
-
isDone
public boolean isDone()
Returns true if the operation is done.
-
getResult
public R getResult() throws SpannerException
Returns result of the operation if the operation is complete and had a result. Returns null if the operation is not complete or did not have a result.- Throws:
SpannerException
- if the operation failed.
-
getName
public String getName()
Returns the name of the operation.
-
isSuccessful
public boolean isSuccessful()
Returns true if the operation completed successfully.
-
-