+ public void transact(final TransactCommand command) {
+ String nodeId = getNodeId().getValue();
+ boolean firstUpdate = firstUpdateTriggered.compareAndSet(false, true);
+ if (reconciliationFt.isDone()) {
+ transact(command, false);
+ } else {
+ LOG.info("Job waiting for reconciliation {}", nodeId);
+ Futures.addCallback(reconciliationFt, new FutureCallback<Boolean>() {
+ @Override
+ public void onSuccess(Boolean aBoolean) {
+ LOG.info("Running the job waiting for reconciliation {}", nodeId);
+ transact(command, false);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+ LOG.info("Running the job waiting for reconciliation {}", nodeId);
+ transact(command, false);
+ }
+ });
+ if (firstUpdate) {
+ LOG.info("Scheduling the reconciliation timeout task {}", nodeId);
+ scheduledExecutorService.schedule( () -> reconciliationFt.set(Boolean.TRUE),
+ HwvtepSouthboundConstants.CONFIG_NODE_UPDATE_MAX_DELAY_MS, TimeUnit.MILLISECONDS);
+ }
+ }
+ }
+
+ public synchronized void transact(TransactCommand command, boolean reconcile) {
+ try {
+ for (TransactInvoker transactInvoker : transactInvokers.values()) {
+ transactInvoker.invoke(command);
+ }
+ } finally {
+ if (reconcile) {
+ reconciliationFt.set(Boolean.TRUE);
+ }