import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
}
/**
- * Create Base Topology
- *
- * @throws TransactionCommitFailedException exception
+ * Create Base Topology.
*/
- synchronized CheckedFuture<Void, TransactionCommitFailedException> instantiateServiceInstance() {
+ synchronized void instantiateServiceInstance() {
final TopologyKey key = InstanceIdentifier.keyOf(this.topology);
final TopologyId topologyId = key.getTopologyId();
final WriteTransaction tx = this.broker.newWriteOnlyTransaction();
.addAugmentation(TopologyTypes1.class, new TopologyTypes1Builder().setTopologyPcep(
new TopologyPcepBuilder().build()).build()).build())
.setNode(new ArrayList<>()).build(), true);
- final CheckedFuture<Void, TransactionCommitFailedException> future = tx.submit();
- Futures.addCallback(future, new FutureCallback<Void>() {
- @Override
- public void onSuccess(final Void result) {
- LOG.debug("PCEP Topology {} created successfully.", topologyId.getValue());
- ServerSessionManager.this.isClosed.set(false);
- }
-
- @Override
- public void onFailure(final Throwable t) {
- LOG.error("Failed to create PCEP Topology {}.", topologyId.getValue(), t);
- ServerSessionManager.this.isClosed.set(true);
- }
- });
- return future;
+ try {
+ tx.submit().get();
+ LOG.info("PCEP Topology {} created successfully.", topologyId.getValue());
+ ServerSessionManager.this.isClosed.set(false);
+ } catch (final ExecutionException | InterruptedException throwable) {
+ LOG.error("Failed to create PCEP Topology {}.", topologyId.getValue(), throwable);
+ ServerSessionManager.this.isClosed.set(true);
+ }
}
private static NodeId createNodeId(final InetAddress addr) {