- final FutureCallback<DOMRpcResult> lockRunningCallback = new FutureCallback<DOMRpcResult>() {
- @Override
- public void onSuccess(DOMRpcResult result) {
- if (isSuccess(result)) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Lock running succesfull");
- }
- } else {
- LOG.warn("{}: lock running invoked unsuccessfully: {}", id, result.getErrors());
- }
- }
-
- @Override
- public void onFailure(Throwable t) {
- LOG.warn("{}: Failed to lock running. Failed to initialize transaction", id, t);
- throw new RuntimeException(id + ": Failed to lock running. Failed to initialize transaction", t);
- }
- };
- netOps.lockRunning(lockRunningCallback);
+ if (isLockAllowed) {
+ resultsFutures.add(netOps.lockRunning(new NetconfRpcFutureCallback("Lock running", id)));
+ } else {
+ LOG.trace("Lock is not allowed: {}", id);
+ }