We are performing a future transformation which boils down to converting
a null (Void) into an CommitInfo.empty().
Rather than doing that, let's make sure AsyncNotifyingSettableFuture
results directly in CommitInfo, removing the need for transformation,
saving us an object allocation and a few CPU cycles.
Change-Id: I7e34ad5e24dc6470d16243dad5ce7ba7395c5397
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
doCanCommit(clientSubmitFuture, transaction, cohorts);
doCanCommit(clientSubmitFuture, transaction, cohorts);
- return FluentFuture.from(clientSubmitFuture).transform(ignored -> CommitInfo.empty(),
- MoreExecutors.directExecutor());
+ return FluentFuture.from(clientSubmitFuture);
}
private void doCanCommit(final AsyncNotifyingSettableFuture clientSubmitFuture,
}
private void doCanCommit(final AsyncNotifyingSettableFuture clientSubmitFuture,
* FIXME: This class should probably be moved to yangtools common utils for re-usability and
* unified with AsyncNotifyingListenableFutureTask.
*/
* FIXME: This class should probably be moved to yangtools common utils for re-usability and
* unified with AsyncNotifyingListenableFutureTask.
*/
- private static class AsyncNotifyingSettableFuture extends AbstractFuture<Void> {
-
+ private static class AsyncNotifyingSettableFuture extends AbstractFuture<CommitInfo> {
/**
* ThreadLocal used to detect if the task completion thread is running the future listener Runnables.
*/
/**
* ThreadLocal used to detect if the task completion thread is running the future listener Runnables.
*/
boolean set() {
ON_TASK_COMPLETION_THREAD_TL.set(Boolean.TRUE);
try {
boolean set() {
ON_TASK_COMPLETION_THREAD_TL.set(Boolean.TRUE);
try {
- return super.set(null);
+ return super.set(CommitInfo.empty());
} finally {
ON_TASK_COMPLETION_THREAD_TL.set(null);
}
} finally {
ON_TASK_COMPLETION_THREAD_TL.set(null);
}