<artifactId>library</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>library</artifactId>
+ <version>${project.version}</version>
+ <type>cfg</type>
+ <classifier>config</classifier>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>utils.servicehelper</artifactId>
<bundle start="true">mvn:com.fasterxml.jackson.core/jackson-annotations/{{VERSION}}</bundle>
<bundle start="true">mvn:com.fasterxml.jackson.core/jackson-core/{{VERSION}}</bundle>
<bundle start="true">mvn:com.fasterxml.jackson.core/jackson-databind/{{VERSION}}</bundle>
+ <configfile finalname="etc/org.opendaylight.ovsdb.library.cfg">mvn:org.opendaylight.ovsdb/library/{{VERSION}}/cfg/config</configfile>
</feature>
</features>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/initial/library.cfg</file>
+ <type>cfg</type>
+ <classifier>config</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
private static volatile boolean singletonCreated = false;
private static final int IDLE_READER_TIMEOUT = 30;
private static final int READ_TIMEOUT = 180;
+ private static final String OVSDB_RPC_TASK_TIMEOUT_PARAM = "ovsdb-rpc-task-timeout";
private static final StalePassiveConnectionService STALE_PASSIVE_CONNECTION_SERVICE =
new StalePassiveConnectionService(executorService);
});
}
}
+
+ public void updateConfigParameter(Map<String, Object> configParameters) {
+ LOG.debug("Config parameters received : {}", configParameters.entrySet());
+ if (configParameters != null && !configParameters.isEmpty()) {
+ for (Map.Entry<String, Object> paramEntry : configParameters.entrySet()) {
+ if (paramEntry.getKey().equalsIgnoreCase(OVSDB_RPC_TASK_TIMEOUT_PARAM)) {
+ JsonRpcEndpoint.setReaperInterval(Integer.parseInt((String)paramEntry.getValue()));
+
+ //Please remove the break if you add more config nobs.
+ break;
+ }
+ }
+ }
+ }
}
public class JsonRpcEndpoint {
private static final Logger LOG = LoggerFactory.getLogger(JsonRpcEndpoint.class);
- private static final int REAPER_INTERVAL = 300;
private static final int REAPER_THREADS = 3;
private static final ThreadFactory FUTURE_REAPER_THREAD_FACTORY = new ThreadFactoryBuilder()
.setNameFormat("OVSDB-Lib-Future-Reaper-%d").build();
private static final ScheduledExecutorService FUTURE_REAPER_SERVICE
= Executors.newScheduledThreadPool(REAPER_THREADS, FUTURE_REAPER_THREAD_FACTORY);
+ private static int reaperInterval = 1000;
+
public class CallContext {
Method method;
JsonRpc10Request request;
cc.getFuture().cancel(false);
}
}
- },REAPER_INTERVAL, TimeUnit.MILLISECONDS);
+ }, reaperInterval, TimeUnit.MILLISECONDS);
nettyChannel.writeAndFlush(requestString);
public Map<String, CallContext> getMethodContext() {
return methodContext;
}
+
+ public static void setReaperInterval(int interval) {
+ reaperInterval = interval;
+ LOG.info("Ovsdb Rpc Task interval is set to {} millisecond", reaperInterval);
+ }
}
--- /dev/null
+#Timeout value (in millisecond) after which OVSDB rpc task will be cancelled.
+#Default value is set to 1000ms, please uncomment and override the value if requires
+#Changing the value don't require controller restart.
+#ovsdb-rpc-task-timeout = 1000
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+ odl:use-default-for-reference-types="true">
<bean id="ovsdbConnectionService" class="org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService">
+ <cm:managed-properties persistent-id="org.opendaylight.ovsdb.library"
+ update-strategy="component-managed"
+ update-method="updateConfigParameter"/>
</bean>
<service ref="ovsdbConnectionService" interface="org.opendaylight.ovsdb.lib.OvsdbConnection"
odl:type="default" />
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collection;
import java.util.List;
+import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
} else {
LOG.debug("Operation task cancelled for transaction : {}", tb);
}
- } catch (InterruptedException | ExecutionException e) {
+ } catch (InterruptedException | ExecutionException | CancellationException e) {
LOG.warn("Transact execution exception: ", e);
}
LOG.trace("invoke exit command: {}, tb: {}", command, tb);