Bug 8152: Transaction is already opened
[netconf.git] / netconf / netconf-topology-singleton / src / main / java / org / opendaylight / netconf / topology / singleton / impl / utils / NetconfTopologySetup.java
index 9ee287d97dfa092a6306c88e2ad8be7502d69e04..be57ce35aa7b0ae6dcf4608f696653cc8d263e5a 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.netconf.client.NetconfClientDispatcher;
 import org.opendaylight.netconf.sal.connect.netconf.NetconfDevice;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import scala.concurrent.duration.Duration;
 
 public class NetconfTopologySetup {
 
@@ -38,6 +39,7 @@ public class NetconfTopologySetup {
     private final NetconfClientDispatcher netconfClientDispatcher;
     private final String topologyId;
     private final NetconfDevice.SchemaResourcesDTO schemaResourceDTO;
+    private final Duration idleTimeout;
 
     private NetconfTopologySetup(final NetconfTopologySetupBuilder builder) {
         this.clusterSingletonServiceProvider = builder.getClusterSingletonServiceProvider();
@@ -54,6 +56,7 @@ public class NetconfTopologySetup {
         this.netconfClientDispatcher = builder.getNetconfClientDispatcher();
         this.topologyId = builder.getTopologyId();
         this.schemaResourceDTO = builder.getSchemaResourceDTO();
+        this.idleTimeout = builder.getIdleTimeout();
     }
 
     public ClusterSingletonServiceProvider getClusterSingletonServiceProvider() {
@@ -112,6 +115,10 @@ public class NetconfTopologySetup {
         return  schemaResourceDTO;
     }
 
+    public Duration getIdleTimeout() {
+        return idleTimeout;
+    }
+
     public static class NetconfTopologySetupBuilder {
 
         private ClusterSingletonServiceProvider clusterSingletonServiceProvider;
@@ -128,6 +135,7 @@ public class NetconfTopologySetup {
         private String topologyId;
         private NetconfClientDispatcher netconfClientDispatcher;
         private NetconfDevice.SchemaResourcesDTO schemaResourceDTO;
+        private Duration idleTimeout;
 
         public NetconfTopologySetupBuilder(){
         }
@@ -186,7 +194,7 @@ public class NetconfTopologySetup {
             return bindingAwareBroker;
         }
 
-        public NetconfTopologySetupBuilder setBindingAwareBroker(BindingAwareBroker bindingAwareBroker) {
+        public NetconfTopologySetupBuilder setBindingAwareBroker(final BindingAwareBroker bindingAwareBroker) {
             this.bindingAwareBroker = bindingAwareBroker;
             return this;
         }
@@ -195,7 +203,7 @@ public class NetconfTopologySetup {
             return keepaliveExecutor;
         }
 
-        public NetconfTopologySetupBuilder setKeepaliveExecutor(ScheduledThreadPool keepaliveExecutor) {
+        public NetconfTopologySetupBuilder setKeepaliveExecutor(final ScheduledThreadPool keepaliveExecutor) {
             this.keepaliveExecutor = keepaliveExecutor;
             return this;
         }
@@ -204,7 +212,7 @@ public class NetconfTopologySetup {
             return processingExecutor;
         }
 
-        public NetconfTopologySetupBuilder setProcessingExecutor(ThreadPool processingExecutor) {
+        public NetconfTopologySetupBuilder setProcessingExecutor(final ThreadPool processingExecutor) {
             this.processingExecutor = processingExecutor;
             return this;
         }
@@ -213,7 +221,7 @@ public class NetconfTopologySetup {
             return domBroker;
         }
 
-        public NetconfTopologySetupBuilder setDomBroker(Broker domBroker) {
+        public NetconfTopologySetupBuilder setDomBroker(final Broker domBroker) {
             this.domBroker = domBroker;
             return this;
         }
@@ -222,7 +230,7 @@ public class NetconfTopologySetup {
             return actorSystem;
         }
 
-        public NetconfTopologySetupBuilder setActorSystem(ActorSystem actorSystem) {
+        public NetconfTopologySetupBuilder setActorSystem(final ActorSystem actorSystem) {
             this.actorSystem = actorSystem;
             return this;
         }
@@ -231,7 +239,7 @@ public class NetconfTopologySetup {
             return eventExecutor;
         }
 
-        public NetconfTopologySetupBuilder setEventExecutor(EventExecutor eventExecutor) {
+        public NetconfTopologySetupBuilder setEventExecutor(final EventExecutor eventExecutor) {
             this.eventExecutor = eventExecutor;
             return this;
         }
@@ -240,7 +248,7 @@ public class NetconfTopologySetup {
             return topologyId;
         }
 
-        public NetconfTopologySetupBuilder setTopologyId(String topologyId) {
+        public NetconfTopologySetupBuilder setTopologyId(final String topologyId) {
             this.topologyId = topologyId;
             return this;
         }
@@ -249,7 +257,7 @@ public class NetconfTopologySetup {
             return netconfClientDispatcher;
         }
 
-        public NetconfTopologySetupBuilder setNetconfClientDispatcher(NetconfClientDispatcher clientDispatcher) {
+        public NetconfTopologySetupBuilder setNetconfClientDispatcher(final NetconfClientDispatcher clientDispatcher) {
             this.netconfClientDispatcher = clientDispatcher;
             return this;
         }
@@ -264,6 +272,15 @@ public class NetconfTopologySetup {
             return schemaResourceDTO;
         }
 
+        public NetconfTopologySetupBuilder setIdleTimeout(final Duration idleTimeout) {
+            this.idleTimeout = idleTimeout;
+            return this;
+        }
+
+        private Duration getIdleTimeout() {
+            return idleTimeout;
+        }
+
         public static NetconfTopologySetupBuilder create() {
             return new NetconfTopologySetupBuilder();
         }