[Falcon] SONA: creates a new thread for handling network config events
Change-Id: Ic972160fac19632e412095a6528544c59379010d
diff --git a/apps/openstackswitching/app/pom.xml b/apps/openstackswitching/app/pom.xml
index ca367b4..026beef 100644
--- a/apps/openstackswitching/app/pom.xml
+++ b/apps/openstackswitching/app/pom.xml
@@ -97,6 +97,16 @@
<artifactId>jersey-client</artifactId>
<version>1.19</version>
</dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-core</artifactId>
+ <version>1.19</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-misc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
@@ -126,7 +136,8 @@
org.apache.karaf.shell.commands,
com.google.common.*,
org.onlab.packet.*,
- org.onosproject.*
+ org.onosproject.*,
+ org.onlab.util.*
</Import-Package>
<Web-ContextPath>${web.context}</Web-ContextPath>
</instructions>
diff --git a/apps/openstackswitching/app/src/main/java/org/onosproject/openstackswitching/OpenstackSwitchingManager.java b/apps/openstackswitching/app/src/main/java/org/onosproject/openstackswitching/OpenstackSwitchingManager.java
index 09c5197..24d5f58 100644
--- a/apps/openstackswitching/app/src/main/java/org/onosproject/openstackswitching/OpenstackSwitchingManager.java
+++ b/apps/openstackswitching/app/src/main/java/org/onosproject/openstackswitching/OpenstackSwitchingManager.java
@@ -67,6 +67,7 @@
import java.util.stream.Collectors;
import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY;
+import static org.onlab.util.Tools.groupedThreads;
@SuppressWarnings("ALL")
@Service
@@ -103,6 +104,7 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected DriverService driverService;
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected FlowRuleService flowRuleService;
private ApplicationId appId;
@@ -114,7 +116,10 @@
private OpenstackArpHandler arpHandler;
private OpenstackRestHandler restHandler;
- private ExecutorService deviceEventExcutorService = Executors.newFixedThreadPool(10);
+ private ExecutorService deviceEventExcutorService =
+ Executors.newSingleThreadExecutor(groupedThreads("onos/openstackswitching", "device-event"));
+ private ExecutorService networkEventExcutorService =
+ Executors.newSingleThreadExecutor(groupedThreads("onos/openstackswitching", "config-event"));
private InternalPacketProcessor internalPacketProcessor = new InternalPacketProcessor();
private InternalDeviceListener internalDeviceListener = new InternalDeviceListener();
@@ -492,7 +497,7 @@
if (((event.type() == NetworkConfigEvent.Type.CONFIG_ADDED ||
event.type() == NetworkConfigEvent.Type.CONFIG_UPDATED)) &&
event.configClass().equals(OpenstackSwitchingConfig.class)) {
- configureNetwork();
+ networkEventExcutorService.execute(this::configureNetwork);
}
}