Class SystemResult
SystemResult is returned from NoSQLHandle.systemStatus(oracle.nosql.driver.ops.SystemStatusRequest)
and
NoSQLHandle.systemRequest(oracle.nosql.driver.ops.SystemRequest)
operations. It encapsulates the
state of the operation requested.
Some operations performed by NoSQLHandle.systemRequest(oracle.nosql.driver.ops.SystemRequest)
are asynchronous.
When such an operation has been performed it is necessary to call
NoSQLHandle.systemStatus(oracle.nosql.driver.ops.SystemStatusRequest)
until the status of the operation is known.
The method waitForCompletion(oracle.nosql.driver.NoSQLHandle, int, int)
exists to perform this task and should
be used whenever possible.
Asynchronous operations (e.g. create namespace) can be distinguished from synchronous System operations in this way:
- Asynchronous operations may return a non-null operationId
- Asynchronous operations modify state, while synchronous operations are read-only
- Synchronous operations return a state of
SystemResult.State.COMPLETE
and have a non-null resultString
NoSQLHandle.systemStatus(oracle.nosql.driver.ops.SystemStatusRequest)
is synchronous, returning the known state of
the operation. It should only be called if the operation was asynchronous
and returned a non-null operationId.-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the operation id for the operation if it was asynchronous.Returns the operation state.Returns the result string for the operation.Returns the statement used for the operation.toString()
void
waitForCompletion
(NoSQLHandle handle, int waitMillis, int delayMillis) Waits for the operation to be complete.Methods inherited from class oracle.nosql.driver.ops.Result
getRateLimitDelayedMs, getRetryStats
-
Constructor Details
-
SystemResult
public SystemResult()
-
-
Method Details
-
getOperationState
Returns the operation state.- Returns:
- the state
-
getOperationId
Returns the operation id for the operation if it was asynchronous. This is null if the request did not generate a new operation and/or the operation state isSystemResult.State.COMPLETE
. The value can be used inSystemStatusRequest.setOperationId(java.lang.String)
to get status and find potential errors resulting from the operation. This method is only useful for the result of asynchronous operations.- Returns:
- the operation id or null if not set
-
getResultString
Returns the result string for the operation. This is null if the request was asynchronous or did not return an actual result. For example the "show" operations return a non-null result string, but "create, drop, grant, etc" operations return a null result string.- Returns:
- the string
-
getStatement
Returns the statement used for the operation.- Returns:
- the statement
-
toString
-
waitForCompletion
Waits for the operation to be complete. This is a blocking, polling style wait that delays for the specified number of milliseconds between each polling operation. This instance is modified with any changes in state.- Parameters:
handle
- the NoSQLHandle to usewaitMillis
- the total amount of time to wait, in millseconds. This value must be non-zero and greater than delayMillisdelayMillis
- the amount of time to wait between polling attempts, in milliseconds. If 0 it will default to 500.- Throws:
IllegalArgumentException
- if the operation times out or the parameters are not valid.NoSQLException
- if the operation id used is unknown or the operation has failed.
-