import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.infra.TypedReadWriteTransaction;
-import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
+import org.opendaylight.infrautils.utils.concurrent.LoggingFutures;
import org.opendaylight.netvirt.elan.l2gw.ha.HwvtepHAUtil;
import org.opendaylight.netvirt.elan.l2gw.ha.listeners.HAJobScheduler;
import org.opendaylight.netvirt.elan.l2gw.ha.merge.GlobalAugmentationMerger;
import org.slf4j.LoggerFactory;
@Singleton
-public class NodeCopier implements INodeCopier {
+public class NodeCopier {
private static final Logger LOG = LoggerFactory.getLogger(NodeCopier.class);
this.txRunner = new ManagedNewTransactionRunnerImpl(db);
}
- @Override
public <D extends Datastore> void copyGlobalNode(Optional<Node> srcGlobalNodeOptional,
InstanceIdentifier<Node> srcPath,
InstanceIdentifier<Node> dstPath,
Futures.addCallback(tx.read(srcPath), new FutureCallback<Optional<Node>>() {
@Override
public void onSuccess(Optional<Node> nodeOptional) {
- HAJobScheduler.getInstance().submitJob(() -> ListenableFutures.addErrorLogging(
+ HAJobScheduler.getInstance().submitJob(() -> LoggingFutures.addErrorLogging(
txRunner.callWithNewReadWriteTransactionAndSubmit(datastoreType, tx -> {
if (nodeOptional.isPresent()) {
copyGlobalNode(nodeOptional, srcPath, dstPath, datastoreType, tx);
haBuilder.setManagers(HwvtepHAUtil.buildManagersForHANode(srcGlobalNodeOptional.get(),
existingDstGlobalNodeOptional));
//Also update the manager section in config which helps in cluster reboot scenarios
- ListenableFutures.addErrorLogging(
+ LoggingFutures.addErrorLogging(
txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
confTx -> haBuilder.getManagers().forEach(manager -> {
InstanceIdentifier<Managers> managerIid =
}
}
- @Override
public <D extends Datastore> void copyPSNode(Optional<Node> srcPsNodeOptional,
InstanceIdentifier<Node> srcPsPath,
InstanceIdentifier<Node> dstPsPath,
@Override
public void onSuccess(Optional<Node> nodeOptional) {
HAJobScheduler.getInstance().submitJob(() -> {
- ListenableFutures.addErrorLogging(
+ LoggingFutures.addErrorLogging(
txRunner.callWithNewReadWriteTransactionAndSubmit(datastoreType, tx -> {
if (nodeOptional.isPresent()) {
copyPSNode(nodeOptional,
*/
HwvtepHAUtil.deleteNodeIfPresent(tx, dstPsPath);
}
- }), LOG, "Failed to read source node {}", srcPsNodeOptional.get());
+ }), LOG, "Failed to read source node {}", srcPsPath);
});
}
@Override
public void onFailure(Throwable throwable) {
}
- });
+ }, MoreExecutors.directExecutor());
return;
}
NodeBuilder dstPsNodeBuilder = HwvtepHAUtil.getNodeBuilderForPath(dstPsPath);