+ }
+
+ // TODO: Auxiliary connections supported ?
+ // Device is disconnected and so we need to close TxManager
+ final ListenableFuture<Void> future = deviceCtx.shuttingDownDataStoreTransactions();
+ Futures.addCallback(future, new FutureCallback<Void>() {
+ @Override
+ public void onSuccess(final Void result) {
+ LOG.debug("TxChainManager for device {} is closed successful.", deviceInfo.getLOGValue());
+ deviceTerminPhaseHandler.onDeviceContextLevelDown(deviceInfo);
+ }
+
+ @Override
+ public void onFailure(final Throwable t) {
+ LOG.warn("TxChainManager for device {} failed by closing.", deviceInfo.getLOGValue());
+ LOG.trace("TxChainManager failed by closing. ", t);
+ deviceTerminPhaseHandler.onDeviceContextLevelDown(deviceInfo);
+ }
+ });
+
+ // Add timer for Close TxManager because it could fail in cluster without notification
+ final TimerTask timerTask = timeout -> {
+ if (!future.isDone()) {
+ LOG.warn("Shutting down TxChain for node {} not completed during 10 sec. Continue anyway.", deviceInfo.getLOGValue());
+ future.cancel(false);
+ }
+ };
+
+ hashedWheelTimer.newTimeout(timerTask, 10, TimeUnit.SECONDS);
+ }
+
+ @VisibleForTesting
+ void addDeviceContextToMap(final DeviceInfo deviceInfo, final DeviceContext deviceContext){
+ deviceContexts.put(deviceInfo, deviceContext);
+ }
+
+ @Override
+ public void setFlowRemovedNotificationOn(boolean isNotificationFlowRemovedOff) {
+ this.isFlowRemovedNotificationOn = isNotificationFlowRemovedOff;
+ }
+
+ @Override
+ public boolean isFlowRemovedNotificationOn() {
+ return this.isFlowRemovedNotificationOn;
+ }
+
+
+ @Override
+ public void setSkipTableFeatures(boolean skipTableFeaturesValue) {
+ skipTableFeatures = skipTableFeaturesValue;
+ }
+
+ @Override
+ public void setBarrierCountLimit(final int barrierCountLimit) {
+ this.barrierCountLimit = barrierCountLimit;
+ }
+
+ @Override
+ public void setBarrierInterval(final long barrierTimeoutLimit) {
+ this.barrierIntervalNanos = TimeUnit.MILLISECONDS.toNanos(barrierTimeoutLimit);
+ }
+
+ @Override
+ public CheckedFuture<Void, TransactionCommitFailedException> removeDeviceFromOperationalDS(final DeviceInfo deviceInfo) {
+ final WriteTransaction delWtx = dataBroker.newWriteOnlyTransaction();
+ delWtx.delete(LogicalDatastoreType.OPERATIONAL, deviceInfo.getNodeInstanceIdentifier());
+ final CheckedFuture<Void, TransactionCommitFailedException> delFuture = delWtx.submit();
+
+ Futures.addCallback(delFuture, new FutureCallback<Void>() {
+ @Override
+ public void onSuccess(final Void result) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Delete Node {} was successful", deviceInfo.getLOGValue());