Package org.apache.curator.x.async
Interface AsyncResult<T>
- Type Parameters:
- T- value type
- All Known Implementing Classes:
- AsyncResultImpl
public interface AsyncResult<T>
     Utility that combines the value, the ZooKeeper result code and the exception in one object
     allowing you to not worry about exceptional completions. i.e. the CompletionStage
     returned by of(AsyncStage) always completes successfully with an
     AsyncResult object.
 
     All three possible results from a ZooKeeper method are encapsulated in this object. If the ZooKeeper
     method succeeds, the internal value will be set. If there was a standard ZooKeeper error code
     (KeeperException.Code.NODEEXISTS, etc.), that code is set and the
     value is null. If there was a general exception, that exception is set, the value will be null
     and the code will be KeeperException.Code.SYSTEMERROR.
 
- 
Method SummaryModifier and TypeMethodDescriptionvoidIf there was a general exception or aKeeperExceptionaRuntimeExceptionis thrown that wraps the exception.voidIf there was a general exception (but not aKeeperException) aRuntimeExceptionis thrown that wraps the exception.org.apache.zookeeper.KeeperException.CodegetCode()Return the ZooKeeper result code.An optional wrapper around any general exceptionReturn any general exception ornullReturns the raw result of the ZooKeeper method ornullgetValue()An optional wrapper around the ZooKeeper method resultstatic <T> CompletionStage<AsyncResult<T>> of(AsyncStage<T> stage) Return a new stage that wraps an async stage into a result-style completion stage.
- 
Method Details- 
ofReturn a new stage that wraps an async stage into a result-style completion stage. The returned CompletionStage will always complete successfully.- Type Parameters:
- T- value type
- Parameters:
- stage- the stage to wrap
- Returns:
- completion stage that resolves to a result
 
- 
getRawValueT getRawValue()Returns the raw result of the ZooKeeper method ornull- Returns:
- result or null
 
- 
getValueAn optional wrapper around the ZooKeeper method result- Returns:
- wrapped result
 
- 
getCodeorg.apache.zookeeper.KeeperException.Code getCode()Return the ZooKeeper result code. If the method was successful,KeeperException.Code.OKis returned. If there was a general exceptionKeeperException.Code.SYSTEMERRORis returned.- Returns:
- result code
 
- 
getRawExceptionThrowable getRawException()Return any general exception ornull- Returns:
- exception or null
 
- 
getExceptionAn optional wrapper around any general exception- Returns:
- wrapped exception
 
- 
checkExceptionvoid checkException()If there was a general exception (but not aKeeperException) aRuntimeExceptionis thrown that wraps the exception. Otherwise, the method returns without any action being performed.
- 
checkErrorvoid checkError()If there was a general exception or aKeeperExceptionaRuntimeExceptionis thrown that wraps the exception. Otherwise, the method returns without any action being performed.
 
-