- try {
- if (LOG.isDebugEnabled()) {
- LOG.debug("syncup start {} waiting:{} guard:{} thread:{}", nodeId.getValue(),
- formatNanos(stampAfterGuard - stampBeforeGuard),
- guard, threadName());
- }
-
- final ListenableFuture<Boolean> endResult =
- delegate.syncup(flowcapableNodePath, configTree, operationalTree, dsType);
-
- Futures.addCallback(endResult, new FutureCallback<Boolean>() {
- @Override
- public void onSuccess(@Nullable final Boolean result) {
- if (LOG.isDebugEnabled()) {
- final long stampFinished = System.nanoTime();
- LOG.debug("syncup finished {} took:{} rpc:{} wait:{} guard:{} permits thread:{}", nodeId.getValue(),
- formatNanos(stampFinished - stampBeforeGuard),
- formatNanos(stampFinished - stampAfterGuard),
- formatNanos(stampAfterGuard - stampBeforeGuard),
- guard.availablePermits(), threadName());
- }
-
- releaseGuardForNodeId(guard);
- }
-
- @Override
- public void onFailure(final Throwable t) {
- if (LOG.isDebugEnabled()) {
- final long stampFinished = System.nanoTime();
- LOG.warn("syncup failed {} took:{} rpc:{} wait:{} guard:{} permits thread:{}", nodeId.getValue(),
- formatNanos(stampFinished - stampBeforeGuard),
- formatNanos(stampFinished - stampAfterGuard),
- formatNanos(stampAfterGuard - stampBeforeGuard),
- guard.availablePermits(), threadName());
- }
-
- releaseGuardForNodeId(guard);
- }
- });
- return endResult;
- } catch (InterruptedException e) {
- releaseGuardForNodeId(guard);
- throw e;