- @Override
- public void dataExists(final YangInstanceIdentifier path, final SettableFuture<Boolean> returnFuture) {
-
- LOG.debug("Tx {} dataExists called path = {}", getIdentifier(), path);
-
- // Send any batched modifications. This is necessary to honor the read uncommitted semantics of the
- // public API contract.
-
- sendBatchedModifications();
-
- OnComplete<Object> onComplete = new OnComplete<Object>() {
- @Override
- public void onComplete(Throwable failure, Object response) throws Throwable {
- if(failure != null) {
- LOG.debug("Tx {} dataExists operation failed: {}", getIdentifier(), failure);
- returnFuture.setException(new ReadFailedException(
- "Error checking data exists for path " + path, failure));
- } else {
- LOG.debug("Tx {} dataExists operation succeeded", getIdentifier(), failure);
-
- if (response instanceof DataExistsReply) {
- returnFuture.set(Boolean.valueOf(((DataExistsReply) response).exists()));
-
- } else if (response.getClass().equals(DataExistsReply.SERIALIZABLE_CLASS)) {
- returnFuture.set(Boolean.valueOf(DataExistsReply.fromSerializable(response).exists()));
-
- } else {
- returnFuture.setException(new ReadFailedException(
- "Invalid response checking exists for path " + path));
- }
- }
- }
- };
-
- Future<Object> future = executeOperationAsync(new DataExists(path));
+ /**
+ * Acquire operation from the limiter if the hand-off has completed. If
+ * the hand-off is still ongoing, this method does nothing.
+ */
+ private final void acquireOperation() {
+ if (isOperationHandOffComplete()) {
+ limiter.acquire();
+ }
+ }