Details
-
Improvement
-
Status: Resolved
-
Resolution: Done
-
None
-
None
-
None
-
Operating System: Linux
Platform: PC
Description
From Robert Varga:
The contract of the async RPC APIs returning Future objects does not allow for actual correct handling of asynchronous semantics. However, it turns out that internally it's actually using ListenableFuture with a thread pool that should allow for this to be done correctly, but this is not documented anywhere.
We need
(1) Document the correct usage of the API through javadoc and other documentation (Perhaps we can generate JavaDoc in the generated service API code that includes usage examples)
(2) Update all tutorials and examples to use the correct semantics.
note this listens to the datastore commits, just as we discussed:
DataModificationTransaction t = dataProvider.beginTransaction();
[...]
Futures.addCallback(JdkFutureAdapters.listenInPoolThread(t.commit()), new FutureCallback<RpcResult<TransactionStatus>>() {
@Override
public void onSuccess(final RpcResult<TransactionStatus> result)
@Override
public void onFailure(final Throwable t) {
LOG.error("Failed to initiate topology {} by listener {}", AbstractTopologyBuilder.this.topology, AbstractTopologyBuilder.this, t);
}
});
I think the current behavior is that the datastores an exception and RpcResult is unused (which kinda is where we want to go anyway). The topology provider is a singleton writer here, so a failure here is not recoverable.
Attachments
Issue Links
- is blocked by
-
CONTROLLER-1092 Design NormalizedNode RPC Broker APIs with clear semantic and error reporting
- Resolved