Converted all executors that previously used namedThreads to use groupedThreads instead.
Change-Id: I048709308270de5b7552bc4e8395b0f7201d5949
Showing
20 changed files
with
125 additions
and
140 deletions
| ... | @@ -15,7 +15,6 @@ | ... | @@ -15,7 +15,6 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.routing.bgp; | 16 | package org.onosproject.routing.bgp; |
| 17 | 17 | ||
| 18 | -import org.osgi.service.component.ComponentContext; | ||
| 19 | import org.apache.felix.scr.annotations.Activate; | 18 | import org.apache.felix.scr.annotations.Activate; |
| 20 | import org.apache.felix.scr.annotations.Component; | 19 | import org.apache.felix.scr.annotations.Component; |
| 21 | import org.apache.felix.scr.annotations.Deactivate; | 20 | import org.apache.felix.scr.annotations.Deactivate; |
| ... | @@ -37,6 +36,7 @@ import org.onlab.packet.Ip6Prefix; | ... | @@ -37,6 +36,7 @@ import org.onlab.packet.Ip6Prefix; |
| 37 | import org.onlab.packet.IpPrefix; | 36 | import org.onlab.packet.IpPrefix; |
| 38 | import org.onosproject.routing.BgpService; | 37 | import org.onosproject.routing.BgpService; |
| 39 | import org.onosproject.routing.RouteListener; | 38 | import org.onosproject.routing.RouteListener; |
| 39 | +import org.osgi.service.component.ComponentContext; | ||
| 40 | import org.slf4j.Logger; | 40 | import org.slf4j.Logger; |
| 41 | import org.slf4j.LoggerFactory; | 41 | import org.slf4j.LoggerFactory; |
| 42 | 42 | ||
| ... | @@ -50,7 +50,7 @@ import java.util.concurrent.ConcurrentMap; | ... | @@ -50,7 +50,7 @@ import java.util.concurrent.ConcurrentMap; |
| 50 | 50 | ||
| 51 | import static com.google.common.base.Preconditions.checkNotNull; | 51 | import static com.google.common.base.Preconditions.checkNotNull; |
| 52 | import static java.util.concurrent.Executors.newCachedThreadPool; | 52 | import static java.util.concurrent.Executors.newCachedThreadPool; |
| 53 | -import static org.onlab.util.Tools.namedThreads; | 53 | +import static org.onlab.util.Tools.groupedThreads; |
| 54 | 54 | ||
| 55 | /** | 55 | /** |
| 56 | * BGP Session Manager class. | 56 | * BGP Session Manager class. |
| ... | @@ -298,8 +298,8 @@ public class BgpSessionManager implements BgpInfoService, BgpService { | ... | @@ -298,8 +298,8 @@ public class BgpSessionManager implements BgpInfoService, BgpService { |
| 298 | this.routeListener = checkNotNull(routeListener); | 298 | this.routeListener = checkNotNull(routeListener); |
| 299 | 299 | ||
| 300 | ChannelFactory channelFactory = new NioServerSocketChannelFactory( | 300 | ChannelFactory channelFactory = new NioServerSocketChannelFactory( |
| 301 | - newCachedThreadPool(namedThreads("onos-bgp-sm-boss-%d")), | 301 | + newCachedThreadPool(groupedThreads("onos/bgp", "sm-boss-%d")), |
| 302 | - newCachedThreadPool(namedThreads("onos-bgp-sm-worker-%d"))); | 302 | + newCachedThreadPool(groupedThreads("onos/bgp", "sm-worker-%d"))); |
| 303 | ChannelPipelineFactory pipelineFactory = new ChannelPipelineFactory() { | 303 | ChannelPipelineFactory pipelineFactory = new ChannelPipelineFactory() { |
| 304 | @Override | 304 | @Override |
| 305 | public ChannelPipeline getPipeline() throws Exception { | 305 | public ChannelPipeline getPipeline() throws Exception { | ... | ... |
| ... | @@ -31,7 +31,7 @@ import java.util.concurrent.ExecutorService; | ... | @@ -31,7 +31,7 @@ import java.util.concurrent.ExecutorService; |
| 31 | import java.util.concurrent.LinkedBlockingQueue; | 31 | import java.util.concurrent.LinkedBlockingQueue; |
| 32 | 32 | ||
| 33 | import static java.util.concurrent.Executors.newSingleThreadExecutor; | 33 | import static java.util.concurrent.Executors.newSingleThreadExecutor; |
| 34 | -import static org.onlab.util.Tools.namedThreads; | 34 | +import static org.onlab.util.Tools.groupedThreads; |
| 35 | import static org.slf4j.LoggerFactory.getLogger; | 35 | import static org.slf4j.LoggerFactory.getLogger; |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| ... | @@ -45,7 +45,7 @@ public class CoreEventDispatcher extends DefaultEventSinkRegistry | ... | @@ -45,7 +45,7 @@ public class CoreEventDispatcher extends DefaultEventSinkRegistry |
| 45 | private final Logger log = getLogger(getClass()); | 45 | private final Logger log = getLogger(getClass()); |
| 46 | 46 | ||
| 47 | private final ExecutorService executor = | 47 | private final ExecutorService executor = |
| 48 | - newSingleThreadExecutor(namedThreads("onos-event-dispatch-%d")); | 48 | + newSingleThreadExecutor(groupedThreads("onos/event", "dispatch-%d")); |
| 49 | 49 | ||
| 50 | @SuppressWarnings("unchecked") | 50 | @SuppressWarnings("unchecked") |
| 51 | private static final Event KILL_PILL = new AbstractEvent(null, 0) { | 51 | private static final Event KILL_PILL = new AbstractEvent(null, 0) { | ... | ... |
| ... | @@ -55,15 +55,13 @@ import org.onosproject.net.provider.AbstractProviderService; | ... | @@ -55,15 +55,13 @@ import org.onosproject.net.provider.AbstractProviderService; |
| 55 | import org.slf4j.Logger; | 55 | import org.slf4j.Logger; |
| 56 | 56 | ||
| 57 | import java.util.List; | 57 | import java.util.List; |
| 58 | -import java.util.concurrent.Executors; | ||
| 59 | import java.util.concurrent.ScheduledExecutorService; | 58 | import java.util.concurrent.ScheduledExecutorService; |
| 60 | import java.util.concurrent.TimeUnit; | 59 | import java.util.concurrent.TimeUnit; |
| 61 | 60 | ||
| 62 | import static com.google.common.base.Preconditions.checkNotNull; | 61 | import static com.google.common.base.Preconditions.checkNotNull; |
| 63 | -import static org.onlab.util.Tools.namedThreads; | 62 | +import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; |
| 64 | -import static org.onosproject.net.MastershipRole.MASTER; | 63 | +import static org.onlab.util.Tools.groupedThreads; |
| 65 | -import static org.onosproject.net.MastershipRole.NONE; | 64 | +import static org.onosproject.net.MastershipRole.*; |
| 66 | -import static org.onosproject.net.MastershipRole.STANDBY; | ||
| 67 | import static org.slf4j.LoggerFactory.getLogger; | 65 | import static org.slf4j.LoggerFactory.getLogger; |
| 68 | 66 | ||
| 69 | /** | 67 | /** |
| ... | @@ -112,7 +110,7 @@ public class DeviceManager | ... | @@ -112,7 +110,7 @@ public class DeviceManager |
| 112 | 110 | ||
| 113 | @Activate | 111 | @Activate |
| 114 | public void activate() { | 112 | public void activate() { |
| 115 | - backgroundService = Executors.newSingleThreadScheduledExecutor(namedThreads("onos-device-manager-background")); | 113 | + backgroundService = newSingleThreadScheduledExecutor(groupedThreads("onos/device", "manager-background")); |
| 116 | 114 | ||
| 117 | store.setDelegate(delegate); | 115 | store.setDelegate(delegate); |
| 118 | eventDispatcher.addSink(DeviceEvent.class, listenerRegistry); | 116 | eventDispatcher.addSink(DeviceEvent.class, listenerRegistry); | ... | ... |
| ... | @@ -56,7 +56,7 @@ import java.util.concurrent.TimeUnit; | ... | @@ -56,7 +56,7 @@ import java.util.concurrent.TimeUnit; |
| 56 | import java.util.concurrent.TimeoutException; | 56 | import java.util.concurrent.TimeoutException; |
| 57 | import java.util.concurrent.atomic.AtomicReference; | 57 | import java.util.concurrent.atomic.AtomicReference; |
| 58 | 58 | ||
| 59 | -import static org.onlab.util.Tools.namedThreads; | 59 | +import static org.onlab.util.Tools.groupedThreads; |
| 60 | import static org.slf4j.LoggerFactory.getLogger; | 60 | import static org.slf4j.LoggerFactory.getLogger; |
| 61 | 61 | ||
| 62 | /** | 62 | /** |
| ... | @@ -93,7 +93,7 @@ public class FlowRuleExtManager extends FlowRuleManager | ... | @@ -93,7 +93,7 @@ public class FlowRuleExtManager extends FlowRuleManager |
| 93 | @Activate | 93 | @Activate |
| 94 | public void activate() { | 94 | public void activate() { |
| 95 | futureService = Executors.newFixedThreadPool( | 95 | futureService = Executors.newFixedThreadPool( |
| 96 | - 32, namedThreads("provider-future-listeners-%d")); | 96 | + 32, groupedThreads("onos/flow", "provider-future-listeners-%d")); |
| 97 | eventDispatcher.addSink(FlowRuleEvent.class, listenerRegistry); | 97 | eventDispatcher.addSink(FlowRuleEvent.class, listenerRegistry); |
| 98 | router.addListener(routerListener); | 98 | router.addListener(routerListener); |
| 99 | log.info("Started"); | 99 | log.info("Started"); | ... | ... |
| ... | @@ -49,7 +49,7 @@ import static com.google.common.base.Preconditions.checkArgument; | ... | @@ -49,7 +49,7 @@ import static com.google.common.base.Preconditions.checkArgument; |
| 49 | import static com.google.common.base.Preconditions.checkNotNull; | 49 | import static com.google.common.base.Preconditions.checkNotNull; |
| 50 | import static com.google.common.collect.Multimaps.synchronizedSetMultimap; | 50 | import static com.google.common.collect.Multimaps.synchronizedSetMultimap; |
| 51 | import static java.util.concurrent.Executors.newSingleThreadExecutor; | 51 | import static java.util.concurrent.Executors.newSingleThreadExecutor; |
| 52 | -import static org.onlab.util.Tools.namedThreads; | 52 | +import static org.onlab.util.Tools.groupedThreads; |
| 53 | import static org.onosproject.net.LinkKey.linkKey; | 53 | import static org.onosproject.net.LinkKey.linkKey; |
| 54 | import static org.onosproject.net.link.LinkEvent.Type.LINK_REMOVED; | 54 | import static org.onosproject.net.link.LinkEvent.Type.LINK_REMOVED; |
| 55 | import static org.onosproject.net.link.LinkEvent.Type.LINK_UPDATED; | 55 | import static org.onosproject.net.link.LinkEvent.Type.LINK_UPDATED; |
| ... | @@ -79,7 +79,7 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -79,7 +79,7 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
| 79 | protected IntentService intentService; | 79 | protected IntentService intentService; |
| 80 | 80 | ||
| 81 | private ExecutorService executorService = | 81 | private ExecutorService executorService = |
| 82 | - newSingleThreadExecutor(namedThreads("onos-flowtracker")); | 82 | + newSingleThreadExecutor(groupedThreads("onos/intent", "flowtracker")); |
| 83 | 83 | ||
| 84 | private TopologyListener listener = new InternalTopologyListener(); | 84 | private TopologyListener listener = new InternalTopologyListener(); |
| 85 | private LinkResourceListener linkResourceListener = | 85 | private LinkResourceListener linkResourceListener = | ... | ... |
| ... | @@ -50,7 +50,7 @@ import java.util.concurrent.ExecutorService; | ... | @@ -50,7 +50,7 @@ import java.util.concurrent.ExecutorService; |
| 50 | 50 | ||
| 51 | import static com.google.common.base.Strings.isNullOrEmpty; | 51 | import static com.google.common.base.Strings.isNullOrEmpty; |
| 52 | import static java.util.concurrent.Executors.newFixedThreadPool; | 52 | import static java.util.concurrent.Executors.newFixedThreadPool; |
| 53 | -import static org.onlab.util.Tools.namedThreads; | 53 | +import static org.onlab.util.Tools.groupedThreads; |
| 54 | import static org.onosproject.core.CoreService.CORE_PROVIDER_ID; | 54 | import static org.onosproject.core.CoreService.CORE_PROVIDER_ID; |
| 55 | import static org.onosproject.net.device.DeviceEvent.Type.*; | 55 | import static org.onosproject.net.device.DeviceEvent.Type.*; |
| 56 | import static org.slf4j.LoggerFactory.getLogger; | 56 | import static org.slf4j.LoggerFactory.getLogger; |
| ... | @@ -115,7 +115,7 @@ public class DefaultTopologyProvider extends AbstractProvider | ... | @@ -115,7 +115,7 @@ public class DefaultTopologyProvider extends AbstractProvider |
| 115 | 115 | ||
| 116 | @Activate | 116 | @Activate |
| 117 | public synchronized void activate(ComponentContext context) { | 117 | public synchronized void activate(ComponentContext context) { |
| 118 | - executor = newFixedThreadPool(MAX_THREADS, namedThreads("onos-topo-build-%d")); | 118 | + executor = newFixedThreadPool(MAX_THREADS, groupedThreads("onos/topo", "build-%d")); |
| 119 | accumulator = new TopologyChangeAccumulator(); | 119 | accumulator = new TopologyChangeAccumulator(); |
| 120 | logConfig("Configured"); | 120 | logConfig("Configured"); |
| 121 | 121 | ... | ... |
| ... | @@ -60,11 +60,9 @@ import java.util.concurrent.ScheduledExecutorService; | ... | @@ -60,11 +60,9 @@ import java.util.concurrent.ScheduledExecutorService; |
| 60 | 60 | ||
| 61 | import static com.google.common.io.ByteStreams.toByteArray; | 61 | import static com.google.common.io.ByteStreams.toByteArray; |
| 62 | import static java.util.concurrent.TimeUnit.MILLISECONDS; | 62 | import static java.util.concurrent.TimeUnit.MILLISECONDS; |
| 63 | -import static org.onlab.util.Tools.namedThreads; | 63 | +import static org.onlab.util.Tools.groupedThreads; |
| 64 | import static org.onosproject.app.ApplicationEvent.Type.*; | 64 | import static org.onosproject.app.ApplicationEvent.Type.*; |
| 65 | -import static org.onosproject.store.app.GossipApplicationStore.InternalState.ACTIVATED; | 65 | +import static org.onosproject.store.app.GossipApplicationStore.InternalState.*; |
| 66 | -import static org.onosproject.store.app.GossipApplicationStore.InternalState.DEACTIVATED; | ||
| 67 | -import static org.onosproject.store.app.GossipApplicationStore.InternalState.INSTALLED; | ||
| 68 | import static org.onosproject.store.ecmap.EventuallyConsistentMapEvent.Type.PUT; | 66 | import static org.onosproject.store.ecmap.EventuallyConsistentMapEvent.Type.PUT; |
| 69 | import static org.onosproject.store.ecmap.EventuallyConsistentMapEvent.Type.REMOVE; | 67 | import static org.onosproject.store.ecmap.EventuallyConsistentMapEvent.Type.REMOVE; |
| 70 | import static org.slf4j.LoggerFactory.getLogger; | 68 | import static org.slf4j.LoggerFactory.getLogger; |
| ... | @@ -90,7 +88,7 @@ public class GossipApplicationStore extends ApplicationArchive | ... | @@ -90,7 +88,7 @@ public class GossipApplicationStore extends ApplicationArchive |
| 90 | } | 88 | } |
| 91 | 89 | ||
| 92 | private final ScheduledExecutorService executor = | 90 | private final ScheduledExecutorService executor = |
| 93 | - Executors.newSingleThreadScheduledExecutor(namedThreads("onos-app-store")); | 91 | + Executors.newSingleThreadScheduledExecutor(groupedThreads("onos/app", "store")); |
| 94 | 92 | ||
| 95 | private EventuallyConsistentMap<ApplicationId, Application> apps; | 93 | private EventuallyConsistentMap<ApplicationId, Application> apps; |
| 96 | private EventuallyConsistentMap<Application, InternalState> states; | 94 | private EventuallyConsistentMap<Application, InternalState> states; | ... | ... |
| ... | @@ -51,7 +51,7 @@ import java.util.concurrent.Future; | ... | @@ -51,7 +51,7 @@ import java.util.concurrent.Future; |
| 51 | import java.util.concurrent.locks.Lock; | 51 | import java.util.concurrent.locks.Lock; |
| 52 | 52 | ||
| 53 | import static com.google.common.base.Preconditions.checkArgument; | 53 | import static com.google.common.base.Preconditions.checkArgument; |
| 54 | -import static org.onlab.util.Tools.namedThreads; | 54 | +import static org.onlab.util.Tools.groupedThreads; |
| 55 | 55 | ||
| 56 | /** | 56 | /** |
| 57 | * Distributed implementation of LeadershipService that is based on Hazelcast. | 57 | * Distributed implementation of LeadershipService that is based on Hazelcast. |
| ... | @@ -266,9 +266,9 @@ public class HazelcastLeadershipService implements LeadershipService { | ... | @@ -266,9 +266,9 @@ public class HazelcastLeadershipService implements LeadershipService { |
| 266 | return; | 266 | return; |
| 267 | } | 267 | } |
| 268 | isShutdown = false; | 268 | isShutdown = false; |
| 269 | - String threadPoolName = "onos-leader-election-" + topicName + "-%d"; | 269 | + String threadPoolName = "election-" + topicName + "-%d"; |
| 270 | leaderElectionExecutor = Executors.newScheduledThreadPool(2, | 270 | leaderElectionExecutor = Executors.newScheduledThreadPool(2, |
| 271 | - namedThreads(threadPoolName)); | 271 | + groupedThreads("onos/leadership", threadPoolName)); |
| 272 | 272 | ||
| 273 | periodicProcessingFuture = | 273 | periodicProcessingFuture = |
| 274 | leaderElectionExecutor.submit(new Runnable() { | 274 | leaderElectionExecutor.submit(new Runnable() { | ... | ... |
| ... | @@ -48,7 +48,7 @@ import java.util.concurrent.ScheduledExecutorService; | ... | @@ -48,7 +48,7 @@ import java.util.concurrent.ScheduledExecutorService; |
| 48 | import java.util.concurrent.TimeUnit; | 48 | import java.util.concurrent.TimeUnit; |
| 49 | 49 | ||
| 50 | import static com.google.common.base.Preconditions.checkArgument; | 50 | import static com.google.common.base.Preconditions.checkArgument; |
| 51 | -import static org.onlab.util.Tools.namedThreads; | 51 | +import static org.onlab.util.Tools.groupedThreads; |
| 52 | import static org.slf4j.LoggerFactory.getLogger; | 52 | import static org.slf4j.LoggerFactory.getLogger; |
| 53 | 53 | ||
| 54 | /** | 54 | /** |
| ... | @@ -69,7 +69,7 @@ public class LeadershipManager implements LeadershipService { | ... | @@ -69,7 +69,7 @@ public class LeadershipManager implements LeadershipService { |
| 69 | 69 | ||
| 70 | // TODO: Make Thread pool size configurable. | 70 | // TODO: Make Thread pool size configurable. |
| 71 | private final ScheduledExecutorService threadPool = | 71 | private final ScheduledExecutorService threadPool = |
| 72 | - Executors.newScheduledThreadPool(25, namedThreads("onos-leadership-manager-%d")); | 72 | + Executors.newScheduledThreadPool(25, groupedThreads("onos/leadership", "manager-%d")); |
| 73 | 73 | ||
| 74 | private static final MessageSubject LEADERSHIP_UPDATES = | 74 | private static final MessageSubject LEADERSHIP_UPDATES = |
| 75 | new MessageSubject("leadership-contest-updates"); | 75 | new MessageSubject("leadership-contest-updates"); | ... | ... |
| ... | @@ -88,8 +88,8 @@ import static com.google.common.base.Predicates.notNull; | ... | @@ -88,8 +88,8 @@ import static com.google.common.base.Predicates.notNull; |
| 88 | import static com.google.common.base.Verify.verify; | 88 | import static com.google.common.base.Verify.verify; |
| 89 | import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | 89 | import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; |
| 90 | import static org.apache.commons.lang3.concurrent.ConcurrentUtils.createIfAbsentUnchecked; | 90 | import static org.apache.commons.lang3.concurrent.ConcurrentUtils.createIfAbsentUnchecked; |
| 91 | +import static org.onlab.util.Tools.groupedThreads; | ||
| 91 | import static org.onlab.util.Tools.minPriority; | 92 | import static org.onlab.util.Tools.minPriority; |
| 92 | -import static org.onlab.util.Tools.namedThreads; | ||
| 93 | import static org.onosproject.cluster.ControllerNodeToNodeId.toNodeId; | 93 | import static org.onosproject.cluster.ControllerNodeToNodeId.toNodeId; |
| 94 | import static org.onosproject.net.DefaultAnnotations.merge; | 94 | import static org.onosproject.net.DefaultAnnotations.merge; |
| 95 | import static org.onosproject.net.device.DeviceEvent.Type.*; | 95 | import static org.onosproject.net.device.DeviceEvent.Type.*; |
| ... | @@ -194,10 +194,10 @@ public class GossipDeviceStore | ... | @@ -194,10 +194,10 @@ public class GossipDeviceStore |
| 194 | clusterCommunicator.addSubscriber( | 194 | clusterCommunicator.addSubscriber( |
| 195 | GossipDeviceStoreMessageSubjects.PORT_INJECTED, new PortInjectedEventListener()); | 195 | GossipDeviceStoreMessageSubjects.PORT_INJECTED, new PortInjectedEventListener()); |
| 196 | 196 | ||
| 197 | - executor = Executors.newCachedThreadPool(namedThreads("onos-device-fg-%d")); | 197 | + executor = Executors.newCachedThreadPool(groupedThreads("onos/device", "fg-%d")); |
| 198 | 198 | ||
| 199 | backgroundExecutor = | 199 | backgroundExecutor = |
| 200 | - newSingleThreadScheduledExecutor(minPriority(namedThreads("onos-device-bg-%d"))); | 200 | + newSingleThreadScheduledExecutor(minPriority(groupedThreads("onos/device", "bg-%d"))); |
| 201 | 201 | ||
| 202 | // start anti-entropy thread | 202 | // start anti-entropy thread |
| 203 | backgroundExecutor.scheduleAtFixedRate(new SendAdvertisementTask(), | 203 | backgroundExecutor.scheduleAtFixedRate(new SendAdvertisementTask(), | ... | ... |
| ... | @@ -91,7 +91,7 @@ import java.util.stream.Collectors; | ... | @@ -91,7 +91,7 @@ import java.util.stream.Collectors; |
| 91 | 91 | ||
| 92 | import static com.google.common.base.Preconditions.checkNotNull; | 92 | import static com.google.common.base.Preconditions.checkNotNull; |
| 93 | import static org.apache.commons.lang3.concurrent.ConcurrentUtils.createIfAbsentUnchecked; | 93 | import static org.apache.commons.lang3.concurrent.ConcurrentUtils.createIfAbsentUnchecked; |
| 94 | -import static org.onlab.util.Tools.namedThreads; | 94 | +import static org.onlab.util.Tools.groupedThreads; |
| 95 | import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVED; | 95 | import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVED; |
| 96 | import static org.onosproject.store.flow.impl.FlowStoreMessageSubjects.*; | 96 | import static org.onosproject.store.flow.impl.FlowStoreMessageSubjects.*; |
| 97 | import static org.slf4j.LoggerFactory.getLogger; | 97 | import static org.slf4j.LoggerFactory.getLogger; |
| ... | @@ -134,7 +134,7 @@ public class DistributedFlowRuleStore | ... | @@ -134,7 +134,7 @@ public class DistributedFlowRuleStore |
| 134 | 134 | ||
| 135 | 135 | ||
| 136 | private final ExecutorService backupExecutors = | 136 | private final ExecutorService backupExecutors = |
| 137 | - Executors.newSingleThreadExecutor(namedThreads("onos-async-backups")); | 137 | + Executors.newSingleThreadExecutor(groupedThreads("onos/flow", "async-backups")); |
| 138 | 138 | ||
| 139 | private boolean syncBackup = false; | 139 | private boolean syncBackup = false; |
| 140 | 140 | ... | ... |
| ... | @@ -62,7 +62,7 @@ import java.util.concurrent.Executors; | ... | @@ -62,7 +62,7 @@ import java.util.concurrent.Executors; |
| 62 | import java.util.concurrent.Future; | 62 | import java.util.concurrent.Future; |
| 63 | import java.util.concurrent.TimeUnit; | 63 | import java.util.concurrent.TimeUnit; |
| 64 | 64 | ||
| 65 | -import static org.onlab.util.Tools.namedThreads; | 65 | +import static org.onlab.util.Tools.groupedThreads; |
| 66 | import static org.onosproject.store.flowext.impl.FlowExtRouterMessageSubjects.APPLY_EXTEND_FLOWS; | 66 | import static org.onosproject.store.flowext.impl.FlowExtRouterMessageSubjects.APPLY_EXTEND_FLOWS; |
| 67 | import static org.slf4j.LoggerFactory.getLogger; | 67 | import static org.slf4j.LoggerFactory.getLogger; |
| 68 | 68 | ||
| ... | @@ -100,7 +100,7 @@ public class DefaultFlowRuleExtRouter | ... | @@ -100,7 +100,7 @@ public class DefaultFlowRuleExtRouter |
| 100 | .build(); | 100 | .build(); |
| 101 | 101 | ||
| 102 | private final ExecutorService futureListeners = Executors | 102 | private final ExecutorService futureListeners = Executors |
| 103 | - .newCachedThreadPool(namedThreads("flowstore-peer-responders")); | 103 | + .newCachedThreadPool(groupedThreads("onos/flow", "store-peer-responders")); |
| 104 | 104 | ||
| 105 | protected static final StoreSerializer SERIALIZER = new KryoSerializer() { | 105 | protected static final StoreSerializer SERIALIZER = new KryoSerializer() { |
| 106 | @Override | 106 | @Override | ... | ... |
| ... | @@ -74,7 +74,6 @@ import java.util.Map.Entry; | ... | @@ -74,7 +74,6 @@ import java.util.Map.Entry; |
| 74 | import java.util.Set; | 74 | import java.util.Set; |
| 75 | import java.util.concurrent.ConcurrentHashMap; | 75 | import java.util.concurrent.ConcurrentHashMap; |
| 76 | import java.util.concurrent.ExecutorService; | 76 | import java.util.concurrent.ExecutorService; |
| 77 | -import java.util.concurrent.Executors; | ||
| 78 | import java.util.concurrent.ScheduledExecutorService; | 77 | import java.util.concurrent.ScheduledExecutorService; |
| 79 | import java.util.concurrent.TimeUnit; | 78 | import java.util.concurrent.TimeUnit; |
| 80 | 79 | ||
| ... | @@ -82,16 +81,15 @@ import static com.google.common.base.Preconditions.checkNotNull; | ... | @@ -82,16 +81,15 @@ import static com.google.common.base.Preconditions.checkNotNull; |
| 82 | import static com.google.common.collect.Multimaps.newSetMultimap; | 81 | import static com.google.common.collect.Multimaps.newSetMultimap; |
| 83 | import static com.google.common.collect.Multimaps.synchronizedSetMultimap; | 82 | import static com.google.common.collect.Multimaps.synchronizedSetMultimap; |
| 84 | import static com.google.common.collect.Sets.newConcurrentHashSet; | 83 | import static com.google.common.collect.Sets.newConcurrentHashSet; |
| 84 | +import static java.util.concurrent.Executors.newCachedThreadPool; | ||
| 85 | import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | 85 | import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; |
| 86 | +import static org.onlab.util.Tools.groupedThreads; | ||
| 86 | import static org.onlab.util.Tools.minPriority; | 87 | import static org.onlab.util.Tools.minPriority; |
| 87 | -import static org.onlab.util.Tools.namedThreads; | ||
| 88 | import static org.onosproject.cluster.ControllerNodeToNodeId.toNodeId; | 88 | import static org.onosproject.cluster.ControllerNodeToNodeId.toNodeId; |
| 89 | import static org.onosproject.net.DefaultAnnotations.merge; | 89 | import static org.onosproject.net.DefaultAnnotations.merge; |
| 90 | import static org.onosproject.net.host.HostEvent.Type.HOST_ADDED; | 90 | import static org.onosproject.net.host.HostEvent.Type.HOST_ADDED; |
| 91 | import static org.onosproject.net.host.HostEvent.Type.HOST_REMOVED; | 91 | import static org.onosproject.net.host.HostEvent.Type.HOST_REMOVED; |
| 92 | -import static org.onosproject.store.host.impl.GossipHostStoreMessageSubjects.HOST_ANTI_ENTROPY_ADVERTISEMENT; | 92 | +import static org.onosproject.store.host.impl.GossipHostStoreMessageSubjects.*; |
| 93 | -import static org.onosproject.store.host.impl.GossipHostStoreMessageSubjects.HOST_REMOVED_MSG; | ||
| 94 | -import static org.onosproject.store.host.impl.GossipHostStoreMessageSubjects.HOST_UPDATED_MSG; | ||
| 95 | import static org.slf4j.LoggerFactory.getLogger; | 93 | import static org.slf4j.LoggerFactory.getLogger; |
| 96 | 94 | ||
| 97 | /** | 95 | /** |
| ... | @@ -166,10 +164,10 @@ public class GossipHostStore | ... | @@ -166,10 +164,10 @@ public class GossipHostStore |
| 166 | HOST_ANTI_ENTROPY_ADVERTISEMENT, | 164 | HOST_ANTI_ENTROPY_ADVERTISEMENT, |
| 167 | new InternalHostAntiEntropyAdvertisementListener()); | 165 | new InternalHostAntiEntropyAdvertisementListener()); |
| 168 | 166 | ||
| 169 | - executor = Executors.newCachedThreadPool(namedThreads("onos-host-fg-%d")); | 167 | + executor = newCachedThreadPool(groupedThreads("onos/host", "fg-%d")); |
| 170 | 168 | ||
| 171 | backgroundExecutor = | 169 | backgroundExecutor = |
| 172 | - newSingleThreadScheduledExecutor(minPriority(namedThreads("onos-host-bg-%d"))); | 170 | + newSingleThreadScheduledExecutor(minPriority(groupedThreads("onos/host", "bg-%d"))); |
| 173 | 171 | ||
| 174 | // start anti-entropy thread | 172 | // start anti-entropy thread |
| 175 | backgroundExecutor.scheduleAtFixedRate(new SendAdvertisementTask(), | 173 | backgroundExecutor.scheduleAtFixedRate(new SendAdvertisementTask(), | ... | ... |
| ... | @@ -81,8 +81,8 @@ import static com.google.common.base.Preconditions.checkNotNull; | ... | @@ -81,8 +81,8 @@ import static com.google.common.base.Preconditions.checkNotNull; |
| 81 | import static com.google.common.base.Predicates.notNull; | 81 | import static com.google.common.base.Predicates.notNull; |
| 82 | import static com.google.common.collect.Multimaps.synchronizedSetMultimap; | 82 | import static com.google.common.collect.Multimaps.synchronizedSetMultimap; |
| 83 | import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | 83 | import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; |
| 84 | +import static org.onlab.util.Tools.groupedThreads; | ||
| 84 | import static org.onlab.util.Tools.minPriority; | 85 | import static org.onlab.util.Tools.minPriority; |
| 85 | -import static org.onlab.util.Tools.namedThreads; | ||
| 86 | import static org.onosproject.cluster.ControllerNodeToNodeId.toNodeId; | 86 | import static org.onosproject.cluster.ControllerNodeToNodeId.toNodeId; |
| 87 | import static org.onosproject.net.DefaultAnnotations.merge; | 87 | import static org.onosproject.net.DefaultAnnotations.merge; |
| 88 | import static org.onosproject.net.DefaultAnnotations.union; | 88 | import static org.onosproject.net.DefaultAnnotations.union; |
| ... | @@ -171,10 +171,10 @@ public class GossipLinkStore | ... | @@ -171,10 +171,10 @@ public class GossipLinkStore |
| 171 | GossipLinkStoreMessageSubjects.LINK_INJECTED, | 171 | GossipLinkStoreMessageSubjects.LINK_INJECTED, |
| 172 | new LinkInjectedEventListener()); | 172 | new LinkInjectedEventListener()); |
| 173 | 173 | ||
| 174 | - executor = Executors.newCachedThreadPool(namedThreads("onos-link-fg-%d")); | 174 | + executor = Executors.newCachedThreadPool(groupedThreads("onos/link", "fg-%d")); |
| 175 | 175 | ||
| 176 | backgroundExecutors = | 176 | backgroundExecutors = |
| 177 | - newSingleThreadScheduledExecutor(minPriority(namedThreads("onos-link-bg-%d"))); | 177 | + newSingleThreadScheduledExecutor(minPriority(groupedThreads("onos/link", "bg-%d"))); |
| 178 | 178 | ||
| 179 | long initialDelaySec = 5; | 179 | long initialDelaySec = 5; |
| 180 | long periodSec = 5; | 180 | long periodSec = 5; | ... | ... |
| ... | @@ -16,15 +16,6 @@ | ... | @@ -16,15 +16,6 @@ |
| 16 | 16 | ||
| 17 | package org.onosproject.openflow.controller.impl; | 17 | package org.onosproject.openflow.controller.impl; |
| 18 | 18 | ||
| 19 | -import static org.onlab.util.Tools.namedThreads; | ||
| 20 | - | ||
| 21 | -import java.lang.management.ManagementFactory; | ||
| 22 | -import java.lang.management.RuntimeMXBean; | ||
| 23 | -import java.net.InetSocketAddress; | ||
| 24 | -import java.util.HashMap; | ||
| 25 | -import java.util.Map; | ||
| 26 | -import java.util.concurrent.Executors; | ||
| 27 | - | ||
| 28 | import org.jboss.netty.bootstrap.ServerBootstrap; | 19 | import org.jboss.netty.bootstrap.ServerBootstrap; |
| 29 | import org.jboss.netty.channel.ChannelPipelineFactory; | 20 | import org.jboss.netty.channel.ChannelPipelineFactory; |
| 30 | import org.jboss.netty.channel.group.ChannelGroup; | 21 | import org.jboss.netty.channel.group.ChannelGroup; |
| ... | @@ -41,6 +32,15 @@ import org.projectfloodlight.openflow.protocol.OFVersion; | ... | @@ -41,6 +32,15 @@ import org.projectfloodlight.openflow.protocol.OFVersion; |
| 41 | import org.slf4j.Logger; | 32 | import org.slf4j.Logger; |
| 42 | import org.slf4j.LoggerFactory; | 33 | import org.slf4j.LoggerFactory; |
| 43 | 34 | ||
| 35 | +import java.lang.management.ManagementFactory; | ||
| 36 | +import java.lang.management.RuntimeMXBean; | ||
| 37 | +import java.net.InetSocketAddress; | ||
| 38 | +import java.util.HashMap; | ||
| 39 | +import java.util.Map; | ||
| 40 | +import java.util.concurrent.Executors; | ||
| 41 | + | ||
| 42 | +import static org.onlab.util.Tools.groupedThreads; | ||
| 43 | + | ||
| 44 | 44 | ||
| 45 | /** | 45 | /** |
| 46 | * The main controller class. Handles all setup and network listeners | 46 | * The main controller class. Handles all setup and network listeners |
| ... | @@ -85,7 +85,6 @@ public class Controller { | ... | @@ -85,7 +85,6 @@ public class Controller { |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | 87 | ||
| 88 | - | ||
| 89 | public Map<String, String> getControllerNodeIPs() { | 88 | public Map<String, String> getControllerNodeIPs() { |
| 90 | // We return a copy of the mapping so we can guarantee that | 89 | // We return a copy of the mapping so we can guarantee that |
| 91 | // the mapping return is the same as one that will be (or was) | 90 | // the mapping return is the same as one that will be (or was) |
| ... | @@ -136,14 +135,14 @@ public class Controller { | ... | @@ -136,14 +135,14 @@ public class Controller { |
| 136 | private ServerBootstrap createServerBootStrap() { | 135 | private ServerBootstrap createServerBootStrap() { |
| 137 | 136 | ||
| 138 | if (workerThreads == 0) { | 137 | if (workerThreads == 0) { |
| 139 | - execFactory = new NioServerSocketChannelFactory( | 138 | + execFactory = new NioServerSocketChannelFactory( |
| 140 | - Executors.newCachedThreadPool(namedThreads("onos-of-boss-%d")), | 139 | + Executors.newCachedThreadPool(groupedThreads("onos/of", "boss-%d")), |
| 141 | - Executors.newCachedThreadPool(namedThreads("onos-of-worker-%d"))); | 140 | + Executors.newCachedThreadPool(groupedThreads("onos/of", "worker-%d"))); |
| 142 | return new ServerBootstrap(execFactory); | 141 | return new ServerBootstrap(execFactory); |
| 143 | } else { | 142 | } else { |
| 144 | execFactory = new NioServerSocketChannelFactory( | 143 | execFactory = new NioServerSocketChannelFactory( |
| 145 | - Executors.newCachedThreadPool(namedThreads("onos-of-boss-%d")), | 144 | + Executors.newCachedThreadPool(groupedThreads("onos/of", "boss-%d")), |
| 146 | - Executors.newCachedThreadPool(namedThreads("onos-of-worker-%d")), workerThreads); | 145 | + Executors.newCachedThreadPool(groupedThreads("onos/of", "worker-%d")), workerThreads); |
| 147 | return new ServerBootstrap(execFactory); | 146 | return new ServerBootstrap(execFactory); |
| 148 | } | 147 | } |
| 149 | } | 148 | } |
| ... | @@ -162,6 +161,7 @@ public class Controller { | ... | @@ -162,6 +161,7 @@ public class Controller { |
| 162 | 161 | ||
| 163 | /** | 162 | /** |
| 164 | * Initialize internal data structures. | 163 | * Initialize internal data structures. |
| 164 | + * | ||
| 165 | * @param configParams configuration parameters | 165 | * @param configParams configuration parameters |
| 166 | */ | 166 | */ |
| 167 | public void init(Map<String, String> configParams) { | 167 | public void init(Map<String, String> configParams) { |
| ... | @@ -195,13 +195,14 @@ public class Controller { | ... | @@ -195,13 +195,14 @@ public class Controller { |
| 195 | 195 | ||
| 196 | /** | 196 | /** |
| 197 | * Forward to the driver-manager to get an IOFSwitch instance. | 197 | * Forward to the driver-manager to get an IOFSwitch instance. |
| 198 | + * | ||
| 198 | * @param dpid data path id | 199 | * @param dpid data path id |
| 199 | * @param desc switch description | 200 | * @param desc switch description |
| 200 | - * @param ofv OpenFlow version | 201 | + * @param ofv OpenFlow version |
| 201 | * @return switch instance | 202 | * @return switch instance |
| 202 | */ | 203 | */ |
| 203 | protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid, | 204 | protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid, |
| 204 | - OFDescStatsReply desc, OFVersion ofv) { | 205 | + OFDescStatsReply desc, OFVersion ofv) { |
| 205 | OpenFlowSwitchDriver sw = DriverManager.getSwitch(new Dpid(dpid), | 206 | OpenFlowSwitchDriver sw = DriverManager.getSwitch(new Dpid(dpid), |
| 206 | desc, ofv); | 207 | desc, ofv); |
| 207 | sw.setAgent(agent); | 208 | sw.setAgent(agent); | ... | ... |
| ... | @@ -15,18 +15,10 @@ | ... | @@ -15,18 +15,10 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.openflow.controller.impl; | 16 | package org.onosproject.openflow.controller.impl; |
| 17 | 17 | ||
| 18 | -import static org.onlab.util.Tools.namedThreads; | 18 | +import com.google.common.collect.ArrayListMultimap; |
| 19 | - | ||
| 20 | -import java.util.Collection; | ||
| 21 | -import java.util.HashSet; | ||
| 22 | -import java.util.Set; | ||
| 23 | -import java.util.concurrent.ConcurrentHashMap; | ||
| 24 | -import java.util.concurrent.ExecutorService; | ||
| 25 | -import java.util.concurrent.Executors; | ||
| 26 | -import java.util.concurrent.locks.Lock; | ||
| 27 | -import java.util.concurrent.locks.ReentrantLock; | ||
| 28 | - | ||
| 29 | import com.google.common.collect.Lists; | 19 | import com.google.common.collect.Lists; |
| 20 | +import com.google.common.collect.Multimap; | ||
| 21 | +import com.google.common.collect.Sets; | ||
| 30 | import org.apache.felix.scr.annotations.Activate; | 22 | import org.apache.felix.scr.annotations.Activate; |
| 31 | import org.apache.felix.scr.annotations.Component; | 23 | import org.apache.felix.scr.annotations.Component; |
| 32 | import org.apache.felix.scr.annotations.Deactivate; | 24 | import org.apache.felix.scr.annotations.Deactivate; |
| ... | @@ -59,9 +51,16 @@ import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; | ... | @@ -59,9 +51,16 @@ import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; |
| 59 | import org.slf4j.Logger; | 51 | import org.slf4j.Logger; |
| 60 | import org.slf4j.LoggerFactory; | 52 | import org.slf4j.LoggerFactory; |
| 61 | 53 | ||
| 62 | -import com.google.common.collect.ArrayListMultimap; | 54 | +import java.util.Collection; |
| 63 | -import com.google.common.collect.Multimap; | 55 | +import java.util.HashSet; |
| 64 | -import com.google.common.collect.Sets; | 56 | +import java.util.Set; |
| 57 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 58 | +import java.util.concurrent.ExecutorService; | ||
| 59 | +import java.util.concurrent.Executors; | ||
| 60 | +import java.util.concurrent.locks.Lock; | ||
| 61 | +import java.util.concurrent.locks.ReentrantLock; | ||
| 62 | + | ||
| 63 | +import static org.onlab.util.Tools.groupedThreads; | ||
| 65 | 64 | ||
| 66 | @Component(immediate = true) | 65 | @Component(immediate = true) |
| 67 | @Service | 66 | @Service |
| ... | @@ -71,12 +70,10 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -71,12 +70,10 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
| 71 | LoggerFactory.getLogger(OpenFlowControllerImpl.class); | 70 | LoggerFactory.getLogger(OpenFlowControllerImpl.class); |
| 72 | 71 | ||
| 73 | private final ExecutorService executorMsgs = | 72 | private final ExecutorService executorMsgs = |
| 74 | - Executors.newFixedThreadPool(32, | 73 | + Executors.newFixedThreadPool(32, groupedThreads("onos/of", "event-stats-%d")); |
| 75 | - namedThreads("onos-of-event-stats-%d")); | ||
| 76 | 74 | ||
| 77 | private final ExecutorService executorBarrier = | 75 | private final ExecutorService executorBarrier = |
| 78 | - Executors.newFixedThreadPool(4, | 76 | + Executors.newFixedThreadPool(4, groupedThreads("onos/of", "event-barrier-%d")); |
| 79 | - namedThreads("onos-of-event-barrier-%d")); | ||
| 80 | 77 | ||
| 81 | protected ConcurrentHashMap<Dpid, OpenFlowSwitch> connectedSwitches = | 78 | protected ConcurrentHashMap<Dpid, OpenFlowSwitch> connectedSwitches = |
| 82 | new ConcurrentHashMap<Dpid, OpenFlowSwitch>(); | 79 | new ConcurrentHashMap<Dpid, OpenFlowSwitch>(); | ... | ... |
| ... | @@ -15,18 +15,9 @@ | ... | @@ -15,18 +15,9 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.provider.lldp.impl; | 16 | package org.onosproject.provider.lldp.impl; |
| 17 | 17 | ||
| 18 | -import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | 18 | +import com.google.common.base.Strings; |
| 19 | -import static org.onlab.util.Tools.namedThreads; | 19 | +import com.google.common.collect.ImmutableMap; |
| 20 | -import static org.slf4j.LoggerFactory.getLogger; | 20 | +import com.google.common.collect.ImmutableSet; |
| 21 | - | ||
| 22 | -import java.io.IOException; | ||
| 23 | -import java.util.Dictionary; | ||
| 24 | -import java.util.EnumSet; | ||
| 25 | -import java.util.Map; | ||
| 26 | -import java.util.concurrent.ConcurrentHashMap; | ||
| 27 | -import java.util.concurrent.ScheduledExecutorService; | ||
| 28 | -import java.util.concurrent.TimeUnit; | ||
| 29 | - | ||
| 30 | import org.apache.felix.scr.annotations.Activate; | 21 | import org.apache.felix.scr.annotations.Activate; |
| 31 | import org.apache.felix.scr.annotations.Component; | 22 | import org.apache.felix.scr.annotations.Component; |
| 32 | import org.apache.felix.scr.annotations.Deactivate; | 23 | import org.apache.felix.scr.annotations.Deactivate; |
| ... | @@ -61,9 +52,17 @@ import org.onosproject.net.provider.ProviderId; | ... | @@ -61,9 +52,17 @@ import org.onosproject.net.provider.ProviderId; |
| 61 | import org.osgi.service.component.ComponentContext; | 52 | import org.osgi.service.component.ComponentContext; |
| 62 | import org.slf4j.Logger; | 53 | import org.slf4j.Logger; |
| 63 | 54 | ||
| 64 | -import com.google.common.base.Strings; | 55 | +import java.io.IOException; |
| 65 | -import com.google.common.collect.ImmutableMap; | 56 | +import java.util.Dictionary; |
| 66 | -import com.google.common.collect.ImmutableSet; | 57 | +import java.util.EnumSet; |
| 58 | +import java.util.Map; | ||
| 59 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 60 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 61 | + | ||
| 62 | +import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | ||
| 63 | +import static java.util.concurrent.TimeUnit.SECONDS; | ||
| 64 | +import static org.onlab.util.Tools.groupedThreads; | ||
| 65 | +import static org.slf4j.LoggerFactory.getLogger; | ||
| 67 | 66 | ||
| 68 | 67 | ||
| 69 | /** | 68 | /** |
| ... | @@ -161,9 +160,8 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -161,9 +160,8 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
| 161 | } | 160 | } |
| 162 | } | 161 | } |
| 163 | 162 | ||
| 164 | - executor = newSingleThreadScheduledExecutor(namedThreads("onos-device-sync-%d")); | 163 | + executor = newSingleThreadScheduledExecutor(groupedThreads("onos/device", "sync-%d")); |
| 165 | - executor.scheduleAtFixedRate(new SyncDeviceInfoTask(), INIT_DELAY, | 164 | + executor.scheduleAtFixedRate(new SyncDeviceInfoTask(), INIT_DELAY, DELAY, SECONDS); |
| 166 | - DELAY, TimeUnit.SECONDS); | ||
| 167 | 165 | ||
| 168 | requestPackets(); | 166 | requestPackets(); |
| 169 | 167 | ... | ... |
providers/null/device/src/main/java/org/onosproject/provider/nil/device/impl/NullDeviceProvider.java
| ... | @@ -15,11 +15,8 @@ | ... | @@ -15,11 +15,8 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.provider.nil.device.impl; | 16 | package org.onosproject.provider.nil.device.impl; |
| 17 | 17 | ||
| 18 | -import static com.google.common.base.Strings.isNullOrEmpty; | ||
| 19 | - | ||
| 20 | import com.google.common.collect.Lists; | 18 | import com.google.common.collect.Lists; |
| 21 | import com.google.common.collect.Maps; | 19 | import com.google.common.collect.Maps; |
| 22 | - | ||
| 23 | import org.apache.felix.scr.annotations.Activate; | 20 | import org.apache.felix.scr.annotations.Activate; |
| 24 | import org.apache.felix.scr.annotations.Component; | 21 | import org.apache.felix.scr.annotations.Component; |
| 25 | import org.apache.felix.scr.annotations.Deactivate; | 22 | import org.apache.felix.scr.annotations.Deactivate; |
| ... | @@ -56,9 +53,8 @@ import java.util.concurrent.ExecutorService; | ... | @@ -56,9 +53,8 @@ import java.util.concurrent.ExecutorService; |
| 56 | import java.util.concurrent.Executors; | 53 | import java.util.concurrent.Executors; |
| 57 | import java.util.concurrent.TimeUnit; | 54 | import java.util.concurrent.TimeUnit; |
| 58 | 55 | ||
| 59 | -import static org.onlab.util.Tools.delay; | 56 | +import static com.google.common.base.Strings.isNullOrEmpty; |
| 60 | -import static org.onlab.util.Tools.namedThreads; | 57 | +import static org.onlab.util.Tools.*; |
| 61 | -import static org.onlab.util.Tools.toHex; | ||
| 62 | import static org.slf4j.LoggerFactory.getLogger; | 58 | import static org.slf4j.LoggerFactory.getLogger; |
| 63 | 59 | ||
| 64 | /** | 60 | /** |
| ... | @@ -79,8 +75,8 @@ public class NullDeviceProvider extends AbstractProvider implements DeviceProvid | ... | @@ -79,8 +75,8 @@ public class NullDeviceProvider extends AbstractProvider implements DeviceProvid |
| 79 | 75 | ||
| 80 | private DeviceProviderService providerService; | 76 | private DeviceProviderService providerService; |
| 81 | 77 | ||
| 82 | - private ExecutorService deviceBuilder = Executors.newFixedThreadPool(1, | 78 | + private ExecutorService deviceBuilder = |
| 83 | - namedThreads("onos-null-device-creator")); | 79 | + Executors.newFixedThreadPool(1, groupedThreads("onos/null", "device-creator")); |
| 84 | 80 | ||
| 85 | 81 | ||
| 86 | //currently hardcoded. will be made configurable via rest/cli. | 82 | //currently hardcoded. will be made configurable via rest/cli. | ... | ... |
| ... | @@ -15,22 +15,9 @@ | ... | @@ -15,22 +15,9 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.provider.nil.link.impl; | 16 | package org.onosproject.provider.nil.link.impl; |
| 17 | 17 | ||
| 18 | -import static com.google.common.base.Strings.isNullOrEmpty; | 18 | +import com.google.common.collect.Lists; |
| 19 | -import static org.onlab.util.Tools.namedThreads; | 19 | +import com.google.common.collect.Maps; |
| 20 | -import static org.slf4j.LoggerFactory.getLogger; | 20 | +import com.google.common.collect.Sets; |
| 21 | -import static org.onlab.util.Tools.toHex; | ||
| 22 | -import static org.onosproject.net.MastershipRole.MASTER; | ||
| 23 | - | ||
| 24 | -import java.util.Dictionary; | ||
| 25 | -import java.util.Iterator; | ||
| 26 | -import java.util.List; | ||
| 27 | -import java.util.Set; | ||
| 28 | -import java.util.Objects; | ||
| 29 | -import java.util.concurrent.ConcurrentMap; | ||
| 30 | -import java.util.concurrent.ExecutorService; | ||
| 31 | -import java.util.concurrent.Executors; | ||
| 32 | -import java.util.concurrent.TimeUnit; | ||
| 33 | - | ||
| 34 | import org.apache.commons.lang3.concurrent.ConcurrentUtils; | 21 | import org.apache.commons.lang3.concurrent.ConcurrentUtils; |
| 35 | import org.apache.felix.scr.annotations.Activate; | 22 | import org.apache.felix.scr.annotations.Activate; |
| 36 | import org.apache.felix.scr.annotations.Component; | 23 | import org.apache.felix.scr.annotations.Component; |
| ... | @@ -63,9 +50,21 @@ import org.onosproject.net.provider.ProviderId; | ... | @@ -63,9 +50,21 @@ import org.onosproject.net.provider.ProviderId; |
| 63 | import org.osgi.service.component.ComponentContext; | 50 | import org.osgi.service.component.ComponentContext; |
| 64 | import org.slf4j.Logger; | 51 | import org.slf4j.Logger; |
| 65 | 52 | ||
| 66 | -import com.google.common.collect.Lists; | 53 | +import java.util.Dictionary; |
| 67 | -import com.google.common.collect.Maps; | 54 | +import java.util.Iterator; |
| 68 | -import com.google.common.collect.Sets; | 55 | +import java.util.List; |
| 56 | +import java.util.Objects; | ||
| 57 | +import java.util.Set; | ||
| 58 | +import java.util.concurrent.ConcurrentMap; | ||
| 59 | +import java.util.concurrent.ExecutorService; | ||
| 60 | +import java.util.concurrent.Executors; | ||
| 61 | +import java.util.concurrent.TimeUnit; | ||
| 62 | + | ||
| 63 | +import static com.google.common.base.Strings.isNullOrEmpty; | ||
| 64 | +import static org.onlab.util.Tools.groupedThreads; | ||
| 65 | +import static org.onlab.util.Tools.toHex; | ||
| 66 | +import static org.onosproject.net.MastershipRole.MASTER; | ||
| 67 | +import static org.slf4j.LoggerFactory.getLogger; | ||
| 69 | 68 | ||
| 70 | /** | 69 | /** |
| 71 | * Provider which advertises fake/nonexistent links to the core. To be used for | 70 | * Provider which advertises fake/nonexistent links to the core. To be used for |
| ... | @@ -114,8 +113,8 @@ public class NullLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -114,8 +113,8 @@ public class NullLinkProvider extends AbstractProvider implements LinkProvider { |
| 114 | 113 | ||
| 115 | private final int checkRateDuration = 10; | 114 | private final int checkRateDuration = 10; |
| 116 | 115 | ||
| 117 | - private ExecutorService linkDriver = Executors.newCachedThreadPool( | 116 | + private ExecutorService linkDriver = |
| 118 | - namedThreads("onos-null-link-driver-%d")); | 117 | + Executors.newCachedThreadPool(groupedThreads("onos/null", "link-driver-%d")); |
| 119 | 118 | ||
| 120 | // For flicker = true, duration between events in msec. | 119 | // For flicker = true, duration between events in msec. |
| 121 | @Property(name = "eventRate", value = "0", | 120 | @Property(name = "eventRate", value = "0", | ... | ... |
providers/null/packet/src/main/java/org/onosproject/provider/nil/packet/impl/NullPacketProvider.java
| ... | @@ -15,17 +15,6 @@ | ... | @@ -15,17 +15,6 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.provider.nil.packet.impl; | 16 | package org.onosproject.provider.nil.packet.impl; |
| 17 | 17 | ||
| 18 | -import static com.google.common.base.Strings.isNullOrEmpty; | ||
| 19 | -import static org.onlab.util.Tools.delay; | ||
| 20 | -import static org.onlab.util.Tools.namedThreads; | ||
| 21 | -import static org.slf4j.LoggerFactory.getLogger; | ||
| 22 | - | ||
| 23 | -import java.nio.ByteBuffer; | ||
| 24 | -import java.util.Dictionary; | ||
| 25 | -import java.util.concurrent.ExecutorService; | ||
| 26 | -import java.util.concurrent.Executors; | ||
| 27 | -import java.util.concurrent.TimeUnit; | ||
| 28 | - | ||
| 29 | import org.apache.felix.scr.annotations.Activate; | 18 | import org.apache.felix.scr.annotations.Activate; |
| 30 | import org.apache.felix.scr.annotations.Component; | 19 | import org.apache.felix.scr.annotations.Component; |
| 31 | import org.apache.felix.scr.annotations.Deactivate; | 20 | import org.apache.felix.scr.annotations.Deactivate; |
| ... | @@ -52,6 +41,17 @@ import org.onosproject.net.provider.ProviderId; | ... | @@ -52,6 +41,17 @@ import org.onosproject.net.provider.ProviderId; |
| 52 | import org.osgi.service.component.ComponentContext; | 41 | import org.osgi.service.component.ComponentContext; |
| 53 | import org.slf4j.Logger; | 42 | import org.slf4j.Logger; |
| 54 | 43 | ||
| 44 | +import java.nio.ByteBuffer; | ||
| 45 | +import java.util.Dictionary; | ||
| 46 | +import java.util.concurrent.ExecutorService; | ||
| 47 | +import java.util.concurrent.Executors; | ||
| 48 | +import java.util.concurrent.TimeUnit; | ||
| 49 | + | ||
| 50 | +import static com.google.common.base.Strings.isNullOrEmpty; | ||
| 51 | +import static org.onlab.util.Tools.delay; | ||
| 52 | +import static org.onlab.util.Tools.groupedThreads; | ||
| 53 | +import static org.slf4j.LoggerFactory.getLogger; | ||
| 54 | + | ||
| 55 | /** | 55 | /** |
| 56 | * Provider which 1) intercepts network-bound messages from the core, and 2) | 56 | * Provider which 1) intercepts network-bound messages from the core, and 2) |
| 57 | * generates PacketEvents at some tunable rate. To be used for benchmarking | 57 | * generates PacketEvents at some tunable rate. To be used for benchmarking |
| ... | @@ -82,8 +82,8 @@ public class NullPacketProvider extends AbstractProvider implements | ... | @@ -82,8 +82,8 @@ public class NullPacketProvider extends AbstractProvider implements |
| 82 | label = "Rate of PacketEvent generation") | 82 | label = "Rate of PacketEvent generation") |
| 83 | private int pktRate = DEFAULT_RATE; | 83 | private int pktRate = DEFAULT_RATE; |
| 84 | 84 | ||
| 85 | - private ExecutorService packetDriver = Executors.newFixedThreadPool(1, | 85 | + private ExecutorService packetDriver = |
| 86 | - namedThreads("onos-null-packet-driver")); | 86 | + Executors.newFixedThreadPool(1, groupedThreads("onos/null", "packet-driver")); |
| 87 | 87 | ||
| 88 | public NullPacketProvider() { | 88 | public NullPacketProvider() { |
| 89 | super(new ProviderId("null", "org.onosproject.provider.nil")); | 89 | super(new ProviderId("null", "org.onosproject.provider.nil")); | ... | ... |
-
Please register or login to post a comment