Thomas Vachuska

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 @@
*/
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.Ip6Prefix;
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 java.util.concurrent.ConcurrentMap;
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 @@ public class BgpSessionManager implements BgpInfoService, BgpService {
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 {
......
......@@ -31,7 +31,7 @@ import java.util.concurrent.ExecutorService;
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 @@ public class CoreEventDispatcher extends DefaultEventSinkRegistry
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) {
......
......@@ -55,15 +55,13 @@ import org.onosproject.net.provider.AbstractProviderService;
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 @@ public class DeviceManager
@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);
......
......@@ -56,7 +56,7 @@ import java.util.concurrent.TimeUnit;
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 @@ public class FlowRuleExtManager extends FlowRuleManager
@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");
......
......@@ -49,7 +49,7 @@ import static com.google.common.base.Preconditions.checkArgument;
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 @@ public class ObjectiveTracker implements ObjectiveTrackerService {
protected IntentService intentService;
private ExecutorService executorService =
newSingleThreadExecutor(namedThreads("onos-flowtracker"));
newSingleThreadExecutor(groupedThreads("onos/intent", "flowtracker"));
private TopologyListener listener = new InternalTopologyListener();
private LinkResourceListener linkResourceListener =
......
......@@ -50,7 +50,7 @@ import java.util.concurrent.ExecutorService;
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 @@ public class DefaultTopologyProvider extends AbstractProvider
@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");
......
......@@ -60,11 +60,9 @@ import java.util.concurrent.ScheduledExecutorService;
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 @@ public class GossipApplicationStore extends ApplicationArchive
}
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;
......
......@@ -51,7 +51,7 @@ import java.util.concurrent.Future;
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 @@ public class HazelcastLeadershipService implements LeadershipService {
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() {
......
......@@ -48,7 +48,7 @@ import java.util.concurrent.ScheduledExecutorService;
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 @@ public class LeadershipManager implements LeadershipService {
// 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");
......
......@@ -88,8 +88,8 @@ import static com.google.common.base.Predicates.notNull;
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 @@ public class GossipDeviceStore
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(),
......
......@@ -91,7 +91,7 @@ import java.util.stream.Collectors;
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 @@ public class DistributedFlowRuleStore
private final ExecutorService backupExecutors =
Executors.newSingleThreadExecutor(namedThreads("onos-async-backups"));
Executors.newSingleThreadExecutor(groupedThreads("onos/flow", "async-backups"));
private boolean syncBackup = false;
......
......@@ -62,7 +62,7 @@ import java.util.concurrent.Executors;
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 @@ public class DefaultFlowRuleExtRouter
.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
......
......@@ -74,7 +74,6 @@ import java.util.Map.Entry;
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.base.Preconditions.checkNotNull;
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 @@ public class GossipHostStore
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(),
......
......@@ -81,8 +81,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
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 @@ public class GossipLinkStore
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;
......
......@@ -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.projectfloodlight.openflow.protocol.OFVersion;
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 class Controller {
}
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 @@ public class Controller {
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 @@ public class Controller {
/**
* Initialize internal data structures.
*
* @param configParams configuration parameters
*/
public void init(Map<String, String> configParams) {
......@@ -195,13 +195,14 @@ public class Controller {
/**
* 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);
......
......@@ -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.projectfloodlight.openflow.protocol.OFStatsReplyFlags;
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 @@ public class OpenFlowControllerImpl implements OpenFlowController {
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>();
......
......@@ -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.onosproject.net.provider.ProviderId;
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 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
}
}
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();
......
......@@ -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.ExecutorService;
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 @@ public class NullDeviceProvider extends AbstractProvider implements DeviceProvid
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.
......
......@@ -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.onosproject.net.provider.ProviderId;
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 @@ public class NullLinkProvider extends AbstractProvider implements LinkProvider {
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",
......
......@@ -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.onosproject.net.provider.ProviderId;
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 @@ public class NullPacketProvider extends AbstractProvider implements
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"));
......