Converted all executors that previously used namedThreads to use groupedThreads instead.
Change-Id: I048709308270de5b7552bc4e8395b0f7201d5949
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSessionManager.java b/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSessionManager.java
index 1dcc82c..45b5d8b 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSessionManager.java
+++ b/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSessionManager.java
@@ -15,7 +15,6 @@
*/
package org.onosproject.routing.bgp;
-import org.osgi.service.component.ComponentContext;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -37,6 +36,7 @@
import org.onlab.packet.IpPrefix;
import org.onosproject.routing.BgpService;
import org.onosproject.routing.RouteListener;
+import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,7 +50,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.concurrent.Executors.newCachedThreadPool;
-import static org.onlab.util.Tools.namedThreads;
+import static org.onlab.util.Tools.groupedThreads;
/**
* BGP Session Manager class.
@@ -298,8 +298,8 @@
this.routeListener = checkNotNull(routeListener);
ChannelFactory channelFactory = new NioServerSocketChannelFactory(
- newCachedThreadPool(namedThreads("onos-bgp-sm-boss-%d")),
- newCachedThreadPool(namedThreads("onos-bgp-sm-worker-%d")));
+ newCachedThreadPool(groupedThreads("onos/bgp", "sm-boss-%d")),
+ newCachedThreadPool(groupedThreads("onos/bgp", "sm-worker-%d")));
ChannelPipelineFactory pipelineFactory = new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
diff --git a/core/net/src/main/java/org/onosproject/event/impl/CoreEventDispatcher.java b/core/net/src/main/java/org/onosproject/event/impl/CoreEventDispatcher.java
index 00538e5..822e6e7 100644
--- a/core/net/src/main/java/org/onosproject/event/impl/CoreEventDispatcher.java
+++ b/core/net/src/main/java/org/onosproject/event/impl/CoreEventDispatcher.java
@@ -31,7 +31,7 @@
import java.util.concurrent.LinkedBlockingQueue;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
-import static org.onlab.util.Tools.namedThreads;
+import static org.onlab.util.Tools.groupedThreads;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -45,7 +45,7 @@
private final Logger log = getLogger(getClass());
private final ExecutorService executor =
- newSingleThreadExecutor(namedThreads("onos-event-dispatch-%d"));
+ newSingleThreadExecutor(groupedThreads("onos/event", "dispatch-%d"));
@SuppressWarnings("unchecked")
private static final Event KILL_PILL = new AbstractEvent(null, 0) {
diff --git a/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java b/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
index 69ef991..5cdaf99 100644
--- a/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
+++ b/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
@@ -55,15 +55,13 @@
import org.slf4j.Logger;
import java.util.List;
-import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onlab.util.Tools.namedThreads;
-import static org.onosproject.net.MastershipRole.MASTER;
-import static org.onosproject.net.MastershipRole.NONE;
-import static org.onosproject.net.MastershipRole.STANDBY;
+import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
+import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.net.MastershipRole.*;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -112,7 +110,7 @@
@Activate
public void activate() {
- backgroundService = Executors.newSingleThreadScheduledExecutor(namedThreads("onos-device-manager-background"));
+ backgroundService = newSingleThreadScheduledExecutor(groupedThreads("onos/device", "manager-background"));
store.setDelegate(delegate);
eventDispatcher.addSink(DeviceEvent.class, listenerRegistry);
diff --git a/core/net/src/main/java/org/onosproject/net/flowext/impl/FlowRuleExtManager.java b/core/net/src/main/java/org/onosproject/net/flowext/impl/FlowRuleExtManager.java
index a6f851b..4cb3f27 100644
--- a/core/net/src/main/java/org/onosproject/net/flowext/impl/FlowRuleExtManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flowext/impl/FlowRuleExtManager.java
@@ -56,7 +56,7 @@
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;
-import static org.onlab.util.Tools.namedThreads;
+import static org.onlab.util.Tools.groupedThreads;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -93,7 +93,7 @@
@Activate
public void activate() {
futureService = Executors.newFixedThreadPool(
- 32, namedThreads("provider-future-listeners-%d"));
+ 32, groupedThreads("onos/flow", "provider-future-listeners-%d"));
eventDispatcher.addSink(FlowRuleEvent.class, listenerRegistry);
router.addListener(routerListener);
log.info("Started");
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
index b6edebf..c32b29c 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
@@ -49,7 +49,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Multimaps.synchronizedSetMultimap;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
-import static org.onlab.util.Tools.namedThreads;
+import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.net.LinkKey.linkKey;
import static org.onosproject.net.link.LinkEvent.Type.LINK_REMOVED;
import static org.onosproject.net.link.LinkEvent.Type.LINK_UPDATED;
@@ -79,7 +79,7 @@
protected IntentService intentService;
private ExecutorService executorService =
- newSingleThreadExecutor(namedThreads("onos-flowtracker"));
+ newSingleThreadExecutor(groupedThreads("onos/intent", "flowtracker"));
private TopologyListener listener = new InternalTopologyListener();
private LinkResourceListener linkResourceListener =
diff --git a/core/net/src/main/java/org/onosproject/net/topology/impl/DefaultTopologyProvider.java b/core/net/src/main/java/org/onosproject/net/topology/impl/DefaultTopologyProvider.java
index 43669c6..1e6ec98 100644
--- a/core/net/src/main/java/org/onosproject/net/topology/impl/DefaultTopologyProvider.java
+++ b/core/net/src/main/java/org/onosproject/net/topology/impl/DefaultTopologyProvider.java
@@ -50,7 +50,7 @@
import static com.google.common.base.Strings.isNullOrEmpty;
import static java.util.concurrent.Executors.newFixedThreadPool;
-import static org.onlab.util.Tools.namedThreads;
+import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.core.CoreService.CORE_PROVIDER_ID;
import static org.onosproject.net.device.DeviceEvent.Type.*;
import static org.slf4j.LoggerFactory.getLogger;
@@ -115,7 +115,7 @@
@Activate
public synchronized void activate(ComponentContext context) {
- executor = newFixedThreadPool(MAX_THREADS, namedThreads("onos-topo-build-%d"));
+ executor = newFixedThreadPool(MAX_THREADS, groupedThreads("onos/topo", "build-%d"));
accumulator = new TopologyChangeAccumulator();
logConfig("Configured");
diff --git a/core/store/dist/src/main/java/org/onosproject/store/app/GossipApplicationStore.java b/core/store/dist/src/main/java/org/onosproject/store/app/GossipApplicationStore.java
index 0a5f8e7..0fd21d0 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/app/GossipApplicationStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/app/GossipApplicationStore.java
@@ -60,11 +60,9 @@
import static com.google.common.io.ByteStreams.toByteArray;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.onlab.util.Tools.namedThreads;
+import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.app.ApplicationEvent.Type.*;
-import static org.onosproject.store.app.GossipApplicationStore.InternalState.ACTIVATED;
-import static org.onosproject.store.app.GossipApplicationStore.InternalState.DEACTIVATED;
-import static org.onosproject.store.app.GossipApplicationStore.InternalState.INSTALLED;
+import static org.onosproject.store.app.GossipApplicationStore.InternalState.*;
import static org.onosproject.store.ecmap.EventuallyConsistentMapEvent.Type.PUT;
import static org.onosproject.store.ecmap.EventuallyConsistentMapEvent.Type.REMOVE;
import static org.slf4j.LoggerFactory.getLogger;
@@ -90,7 +88,7 @@
}
private final ScheduledExecutorService executor =
- Executors.newSingleThreadScheduledExecutor(namedThreads("onos-app-store"));
+ Executors.newSingleThreadScheduledExecutor(groupedThreads("onos/app", "store"));
private EventuallyConsistentMap<ApplicationId, Application> apps;
private EventuallyConsistentMap<Application, InternalState> states;
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/HazelcastLeadershipService.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/HazelcastLeadershipService.java
index df746f7..7298f2c 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/HazelcastLeadershipService.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/HazelcastLeadershipService.java
@@ -51,7 +51,7 @@
import java.util.concurrent.locks.Lock;
import static com.google.common.base.Preconditions.checkArgument;
-import static org.onlab.util.Tools.namedThreads;
+import static org.onlab.util.Tools.groupedThreads;
/**
* Distributed implementation of LeadershipService that is based on Hazelcast.
@@ -266,9 +266,9 @@
return;
}
isShutdown = false;
- String threadPoolName = "onos-leader-election-" + topicName + "-%d";
+ String threadPoolName = "election-" + topicName + "-%d";
leaderElectionExecutor = Executors.newScheduledThreadPool(2,
- namedThreads(threadPoolName));
+ groupedThreads("onos/leadership", threadPoolName));
periodicProcessingFuture =
leaderElectionExecutor.submit(new Runnable() {
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/LeadershipManager.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/LeadershipManager.java
index 8f3068c..6919ea1 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/LeadershipManager.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/LeadershipManager.java
@@ -48,7 +48,7 @@
import java.util.concurrent.TimeUnit;
import static com.google.common.base.Preconditions.checkArgument;
-import static org.onlab.util.Tools.namedThreads;
+import static org.onlab.util.Tools.groupedThreads;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -69,7 +69,7 @@
// TODO: Make Thread pool size configurable.
private final ScheduledExecutorService threadPool =
- Executors.newScheduledThreadPool(25, namedThreads("onos-leadership-manager-%d"));
+ Executors.newScheduledThreadPool(25, groupedThreads("onos/leadership", "manager-%d"));
private static final MessageSubject LEADERSHIP_UPDATES =
new MessageSubject("leadership-contest-updates");
diff --git a/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java b/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
index d29fadb..602fd9f 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
@@ -88,8 +88,8 @@
import static com.google.common.base.Verify.verify;
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
import static org.apache.commons.lang3.concurrent.ConcurrentUtils.createIfAbsentUnchecked;
+import static org.onlab.util.Tools.groupedThreads;
import static org.onlab.util.Tools.minPriority;
-import static org.onlab.util.Tools.namedThreads;
import static org.onosproject.cluster.ControllerNodeToNodeId.toNodeId;
import static org.onosproject.net.DefaultAnnotations.merge;
import static org.onosproject.net.device.DeviceEvent.Type.*;
@@ -194,10 +194,10 @@
clusterCommunicator.addSubscriber(
GossipDeviceStoreMessageSubjects.PORT_INJECTED, new PortInjectedEventListener());
- executor = Executors.newCachedThreadPool(namedThreads("onos-device-fg-%d"));
+ executor = Executors.newCachedThreadPool(groupedThreads("onos/device", "fg-%d"));
backgroundExecutor =
- newSingleThreadScheduledExecutor(minPriority(namedThreads("onos-device-bg-%d")));
+ newSingleThreadScheduledExecutor(minPriority(groupedThreads("onos/device", "bg-%d")));
// start anti-entropy thread
backgroundExecutor.scheduleAtFixedRate(new SendAdvertisementTask(),
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java
index e854201..86bc173 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java
@@ -91,7 +91,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static org.apache.commons.lang3.concurrent.ConcurrentUtils.createIfAbsentUnchecked;
-import static org.onlab.util.Tools.namedThreads;
+import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVED;
import static org.onosproject.store.flow.impl.FlowStoreMessageSubjects.*;
import static org.slf4j.LoggerFactory.getLogger;
@@ -134,7 +134,7 @@
private final ExecutorService backupExecutors =
- Executors.newSingleThreadExecutor(namedThreads("onos-async-backups"));
+ Executors.newSingleThreadExecutor(groupedThreads("onos/flow", "async-backups"));
private boolean syncBackup = false;
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flowext/impl/DefaultFlowRuleExtRouter.java b/core/store/dist/src/main/java/org/onosproject/store/flowext/impl/DefaultFlowRuleExtRouter.java
index edf38f3..6effe1b 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flowext/impl/DefaultFlowRuleExtRouter.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flowext/impl/DefaultFlowRuleExtRouter.java
@@ -62,7 +62,7 @@
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import static org.onlab.util.Tools.namedThreads;
+import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.store.flowext.impl.FlowExtRouterMessageSubjects.APPLY_EXTEND_FLOWS;
import static org.slf4j.LoggerFactory.getLogger;
@@ -100,7 +100,7 @@
.build();
private final ExecutorService futureListeners = Executors
- .newCachedThreadPool(namedThreads("flowstore-peer-responders"));
+ .newCachedThreadPool(groupedThreads("onos/flow", "store-peer-responders"));
protected static final StoreSerializer SERIALIZER = new KryoSerializer() {
@Override
diff --git a/core/store/dist/src/main/java/org/onosproject/store/host/impl/GossipHostStore.java b/core/store/dist/src/main/java/org/onosproject/store/host/impl/GossipHostStore.java
index 93ff1a3..f472d27 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/host/impl/GossipHostStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/host/impl/GossipHostStore.java
@@ -74,7 +74,6 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -82,16 +81,15 @@
import static com.google.common.collect.Multimaps.newSetMultimap;
import static com.google.common.collect.Multimaps.synchronizedSetMultimap;
import static com.google.common.collect.Sets.newConcurrentHashSet;
+import static java.util.concurrent.Executors.newCachedThreadPool;
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
+import static org.onlab.util.Tools.groupedThreads;
import static org.onlab.util.Tools.minPriority;
-import static org.onlab.util.Tools.namedThreads;
import static org.onosproject.cluster.ControllerNodeToNodeId.toNodeId;
import static org.onosproject.net.DefaultAnnotations.merge;
import static org.onosproject.net.host.HostEvent.Type.HOST_ADDED;
import static org.onosproject.net.host.HostEvent.Type.HOST_REMOVED;
-import static org.onosproject.store.host.impl.GossipHostStoreMessageSubjects.HOST_ANTI_ENTROPY_ADVERTISEMENT;
-import static org.onosproject.store.host.impl.GossipHostStoreMessageSubjects.HOST_REMOVED_MSG;
-import static org.onosproject.store.host.impl.GossipHostStoreMessageSubjects.HOST_UPDATED_MSG;
+import static org.onosproject.store.host.impl.GossipHostStoreMessageSubjects.*;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -166,10 +164,10 @@
HOST_ANTI_ENTROPY_ADVERTISEMENT,
new InternalHostAntiEntropyAdvertisementListener());
- executor = Executors.newCachedThreadPool(namedThreads("onos-host-fg-%d"));
+ executor = newCachedThreadPool(groupedThreads("onos/host", "fg-%d"));
backgroundExecutor =
- newSingleThreadScheduledExecutor(minPriority(namedThreads("onos-host-bg-%d")));
+ newSingleThreadScheduledExecutor(minPriority(groupedThreads("onos/host", "bg-%d")));
// start anti-entropy thread
backgroundExecutor.scheduleAtFixedRate(new SendAdvertisementTask(),
diff --git a/core/store/dist/src/main/java/org/onosproject/store/link/impl/GossipLinkStore.java b/core/store/dist/src/main/java/org/onosproject/store/link/impl/GossipLinkStore.java
index 6131190..60d54e3 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/link/impl/GossipLinkStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/link/impl/GossipLinkStore.java
@@ -81,8 +81,8 @@
import static com.google.common.base.Predicates.notNull;
import static com.google.common.collect.Multimaps.synchronizedSetMultimap;
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
+import static org.onlab.util.Tools.groupedThreads;
import static org.onlab.util.Tools.minPriority;
-import static org.onlab.util.Tools.namedThreads;
import static org.onosproject.cluster.ControllerNodeToNodeId.toNodeId;
import static org.onosproject.net.DefaultAnnotations.merge;
import static org.onosproject.net.DefaultAnnotations.union;
@@ -171,10 +171,10 @@
GossipLinkStoreMessageSubjects.LINK_INJECTED,
new LinkInjectedEventListener());
- executor = Executors.newCachedThreadPool(namedThreads("onos-link-fg-%d"));
+ executor = Executors.newCachedThreadPool(groupedThreads("onos/link", "fg-%d"));
backgroundExecutors =
- newSingleThreadScheduledExecutor(minPriority(namedThreads("onos-link-bg-%d")));
+ newSingleThreadScheduledExecutor(minPriority(groupedThreads("onos/link", "bg-%d")));
long initialDelaySec = 5;
long periodSec = 5;
diff --git a/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/Controller.java b/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/Controller.java
index ed787db..23fd149 100644
--- a/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/Controller.java
+++ b/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/Controller.java
@@ -16,15 +16,6 @@
package org.onosproject.openflow.controller.impl;
-import static org.onlab.util.Tools.namedThreads;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
-import java.net.InetSocketAddress;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.Executors;
-
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.group.ChannelGroup;
@@ -41,6 +32,15 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+import java.net.InetSocketAddress;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Executors;
+
+import static org.onlab.util.Tools.groupedThreads;
+
/**
* The main controller class. Handles all setup and network listeners
@@ -85,7 +85,6 @@
}
-
public Map<String, String> getControllerNodeIPs() {
// We return a copy of the mapping so we can guarantee that
// the mapping return is the same as one that will be (or was)
@@ -136,14 +135,14 @@
private ServerBootstrap createServerBootStrap() {
if (workerThreads == 0) {
- execFactory = new NioServerSocketChannelFactory(
- Executors.newCachedThreadPool(namedThreads("onos-of-boss-%d")),
- Executors.newCachedThreadPool(namedThreads("onos-of-worker-%d")));
+ execFactory = new NioServerSocketChannelFactory(
+ Executors.newCachedThreadPool(groupedThreads("onos/of", "boss-%d")),
+ Executors.newCachedThreadPool(groupedThreads("onos/of", "worker-%d")));
return new ServerBootstrap(execFactory);
} else {
execFactory = new NioServerSocketChannelFactory(
- Executors.newCachedThreadPool(namedThreads("onos-of-boss-%d")),
- Executors.newCachedThreadPool(namedThreads("onos-of-worker-%d")), workerThreads);
+ Executors.newCachedThreadPool(groupedThreads("onos/of", "boss-%d")),
+ Executors.newCachedThreadPool(groupedThreads("onos/of", "worker-%d")), workerThreads);
return new ServerBootstrap(execFactory);
}
}
@@ -162,6 +161,7 @@
/**
* Initialize internal data structures.
+ *
* @param configParams configuration parameters
*/
public void init(Map<String, String> configParams) {
@@ -195,13 +195,14 @@
/**
* Forward to the driver-manager to get an IOFSwitch instance.
+ *
* @param dpid data path id
* @param desc switch description
- * @param ofv OpenFlow version
+ * @param ofv OpenFlow version
* @return switch instance
*/
protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid,
- OFDescStatsReply desc, OFVersion ofv) {
+ OFDescStatsReply desc, OFVersion ofv) {
OpenFlowSwitchDriver sw = DriverManager.getSwitch(new Dpid(dpid),
desc, ofv);
sw.setAgent(agent);
diff --git a/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java b/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
index 4a1e684..a98f000 100644
--- a/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
+++ b/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
@@ -15,18 +15,10 @@
*/
package org.onosproject.openflow.controller.impl;
-import static org.onlab.util.Tools.namedThreads;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
+import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Sets;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -59,9 +51,16 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import static org.onlab.util.Tools.groupedThreads;
@Component(immediate = true)
@Service
@@ -71,12 +70,10 @@
LoggerFactory.getLogger(OpenFlowControllerImpl.class);
private final ExecutorService executorMsgs =
- Executors.newFixedThreadPool(32,
- namedThreads("onos-of-event-stats-%d"));
+ Executors.newFixedThreadPool(32, groupedThreads("onos/of", "event-stats-%d"));
private final ExecutorService executorBarrier =
- Executors.newFixedThreadPool(4,
- namedThreads("onos-of-event-barrier-%d"));
+ Executors.newFixedThreadPool(4, groupedThreads("onos/of", "event-barrier-%d"));
protected ConcurrentHashMap<Dpid, OpenFlowSwitch> connectedSwitches =
new ConcurrentHashMap<Dpid, OpenFlowSwitch>();
diff --git a/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LLDPLinkProvider.java b/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LLDPLinkProvider.java
index 57c1e7a..9350410 100644
--- a/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LLDPLinkProvider.java
+++ b/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LLDPLinkProvider.java
@@ -15,18 +15,9 @@
*/
package org.onosproject.provider.lldp.impl;
-import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
-import static org.onlab.util.Tools.namedThreads;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.io.IOException;
-import java.util.Dictionary;
-import java.util.EnumSet;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -61,9 +52,17 @@
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.EnumSet;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledExecutorService;
+
+import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.onlab.util.Tools.groupedThreads;
+import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -161,9 +160,8 @@
}
}
- executor = newSingleThreadScheduledExecutor(namedThreads("onos-device-sync-%d"));
- executor.scheduleAtFixedRate(new SyncDeviceInfoTask(), INIT_DELAY,
- DELAY, TimeUnit.SECONDS);
+ executor = newSingleThreadScheduledExecutor(groupedThreads("onos/device", "sync-%d"));
+ executor.scheduleAtFixedRate(new SyncDeviceInfoTask(), INIT_DELAY, DELAY, SECONDS);
requestPackets();
diff --git a/providers/null/device/src/main/java/org/onosproject/provider/nil/device/impl/NullDeviceProvider.java b/providers/null/device/src/main/java/org/onosproject/provider/nil/device/impl/NullDeviceProvider.java
index d18ba5a..fc59111 100644
--- a/providers/null/device/src/main/java/org/onosproject/provider/nil/device/impl/NullDeviceProvider.java
+++ b/providers/null/device/src/main/java/org/onosproject/provider/nil/device/impl/NullDeviceProvider.java
@@ -15,11 +15,8 @@
*/
package org.onosproject.provider.nil.device.impl;
-import static com.google.common.base.Strings.isNullOrEmpty;
-
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -56,9 +53,8 @@
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
-import static org.onlab.util.Tools.delay;
-import static org.onlab.util.Tools.namedThreads;
-import static org.onlab.util.Tools.toHex;
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static org.onlab.util.Tools.*;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -79,8 +75,8 @@
private DeviceProviderService providerService;
- private ExecutorService deviceBuilder = Executors.newFixedThreadPool(1,
- namedThreads("onos-null-device-creator"));
+ private ExecutorService deviceBuilder =
+ Executors.newFixedThreadPool(1, groupedThreads("onos/null", "device-creator"));
//currently hardcoded. will be made configurable via rest/cli.
diff --git a/providers/null/link/src/main/java/org/onosproject/provider/nil/link/impl/NullLinkProvider.java b/providers/null/link/src/main/java/org/onosproject/provider/nil/link/impl/NullLinkProvider.java
index c0a3d06..2f5939a 100644
--- a/providers/null/link/src/main/java/org/onosproject/provider/nil/link/impl/NullLinkProvider.java
+++ b/providers/null/link/src/main/java/org/onosproject/provider/nil/link/impl/NullLinkProvider.java
@@ -15,22 +15,9 @@
*/
package org.onosproject.provider.nil.link.impl;
-import static com.google.common.base.Strings.isNullOrEmpty;
-import static org.onlab.util.Tools.namedThreads;
-import static org.slf4j.LoggerFactory.getLogger;
-import static org.onlab.util.Tools.toHex;
-import static org.onosproject.net.MastershipRole.MASTER;
-
-import java.util.Dictionary;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import org.apache.commons.lang3.concurrent.ConcurrentUtils;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
@@ -63,9 +50,21 @@
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
+import java.util.Dictionary;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static org.onlab.util.Tools.groupedThreads;
+import static org.onlab.util.Tools.toHex;
+import static org.onosproject.net.MastershipRole.MASTER;
+import static org.slf4j.LoggerFactory.getLogger;
/**
* Provider which advertises fake/nonexistent links to the core. To be used for
@@ -114,8 +113,8 @@
private final int checkRateDuration = 10;
- private ExecutorService linkDriver = Executors.newCachedThreadPool(
- namedThreads("onos-null-link-driver-%d"));
+ private ExecutorService linkDriver =
+ Executors.newCachedThreadPool(groupedThreads("onos/null", "link-driver-%d"));
// For flicker = true, duration between events in msec.
@Property(name = "eventRate", value = "0",
diff --git a/providers/null/packet/src/main/java/org/onosproject/provider/nil/packet/impl/NullPacketProvider.java b/providers/null/packet/src/main/java/org/onosproject/provider/nil/packet/impl/NullPacketProvider.java
index ddf57be..82f6ace 100644
--- a/providers/null/packet/src/main/java/org/onosproject/provider/nil/packet/impl/NullPacketProvider.java
+++ b/providers/null/packet/src/main/java/org/onosproject/provider/nil/packet/impl/NullPacketProvider.java
@@ -15,17 +15,6 @@
*/
package org.onosproject.provider.nil.packet.impl;
-import static com.google.common.base.Strings.isNullOrEmpty;
-import static org.onlab.util.Tools.delay;
-import static org.onlab.util.Tools.namedThreads;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.nio.ByteBuffer;
-import java.util.Dictionary;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -52,6 +41,17 @@
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
+import java.nio.ByteBuffer;
+import java.util.Dictionary;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static org.onlab.util.Tools.delay;
+import static org.onlab.util.Tools.groupedThreads;
+import static org.slf4j.LoggerFactory.getLogger;
+
/**
* Provider which 1) intercepts network-bound messages from the core, and 2)
* generates PacketEvents at some tunable rate. To be used for benchmarking
@@ -82,8 +82,8 @@
label = "Rate of PacketEvent generation")
private int pktRate = DEFAULT_RATE;
- private ExecutorService packetDriver = Executors.newFixedThreadPool(1,
- namedThreads("onos-null-packet-driver"));
+ private ExecutorService packetDriver =
+ Executors.newFixedThreadPool(1, groupedThreads("onos/null", "packet-driver"));
public NullPacketProvider() {
super(new ProviderId("null", "org.onosproject.provider.nil"));