Committed by
Yuta HIGUCHI
Assigning names to various threads
- specify nearby logger when possible Change-Id: Ia8925ab1459c4d1da922becd0e201388d44d4294
Showing
28 changed files
with
81 additions
and
45 deletions
... | @@ -47,6 +47,7 @@ import java.util.concurrent.ScheduledFuture; | ... | @@ -47,6 +47,7 @@ import java.util.concurrent.ScheduledFuture; |
47 | import java.util.concurrent.TimeUnit; | 47 | import java.util.concurrent.TimeUnit; |
48 | 48 | ||
49 | import static com.google.common.base.Strings.isNullOrEmpty; | 49 | import static com.google.common.base.Strings.isNullOrEmpty; |
50 | +import static java.util.concurrent.Executors.newScheduledThreadPool; | ||
50 | import static org.onlab.util.Tools.get; | 51 | import static org.onlab.util.Tools.get; |
51 | import static org.onlab.util.Tools.groupedThreads; | 52 | import static org.onlab.util.Tools.groupedThreads; |
52 | import static org.slf4j.LoggerFactory.getLogger; | 53 | import static org.slf4j.LoggerFactory.getLogger; |
... | @@ -100,7 +101,9 @@ public class PollingAlarmProvider extends AbstractProvider implements AlarmProvi | ... | @@ -100,7 +101,9 @@ public class PollingAlarmProvider extends AbstractProvider implements AlarmProvi |
100 | 101 | ||
101 | @Activate | 102 | @Activate |
102 | public void activate(ComponentContext context) { | 103 | public void activate(ComponentContext context) { |
103 | - alarmsExecutor = Executors.newScheduledThreadPool(CORE_POOL_SIZE); | 104 | + alarmsExecutor = newScheduledThreadPool(CORE_POOL_SIZE, |
105 | + groupedThreads("onos/pollingalarmprovider", | ||
106 | + "alarm-executor-%d", log)); | ||
104 | eventHandlingExecutor = | 107 | eventHandlingExecutor = |
105 | Executors.newFixedThreadPool(CORE_POOL_SIZE, | 108 | Executors.newFixedThreadPool(CORE_POOL_SIZE, |
106 | groupedThreads("onos/pollingalarmprovider", | 109 | groupedThreads("onos/pollingalarmprovider", | ... | ... |
... | @@ -36,12 +36,13 @@ import org.onosproject.mastership.MastershipListener; | ... | @@ -36,12 +36,13 @@ import org.onosproject.mastership.MastershipListener; |
36 | import org.onosproject.mastership.MastershipService; | 36 | import org.onosproject.mastership.MastershipService; |
37 | import org.slf4j.Logger; | 37 | import org.slf4j.Logger; |
38 | 38 | ||
39 | -import java.util.concurrent.Executors; | ||
40 | import java.util.concurrent.Future; | 39 | import java.util.concurrent.Future; |
41 | import java.util.concurrent.TimeUnit; | 40 | import java.util.concurrent.TimeUnit; |
42 | import java.util.concurrent.atomic.AtomicBoolean; | 41 | import java.util.concurrent.atomic.AtomicBoolean; |
43 | import java.util.concurrent.atomic.AtomicReference; | 42 | import java.util.concurrent.atomic.AtomicReference; |
44 | 43 | ||
44 | +import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | ||
45 | +import static org.onlab.util.Tools.groupedThreads; | ||
45 | import static org.slf4j.LoggerFactory.getLogger; | 46 | import static org.slf4j.LoggerFactory.getLogger; |
46 | 47 | ||
47 | /** | 48 | /** |
... | @@ -87,7 +88,7 @@ public class MastershipLoadBalancer { | ... | @@ -87,7 +88,7 @@ public class MastershipLoadBalancer { |
87 | 88 | ||
88 | //Ensures that all executions do not interfere with one another (single thread) | 89 | //Ensures that all executions do not interfere with one another (single thread) |
89 | private ListeningScheduledExecutorService executorService = MoreExecutors. | 90 | private ListeningScheduledExecutorService executorService = MoreExecutors. |
90 | - listeningDecorator(Executors.newSingleThreadScheduledExecutor()); | 91 | + listeningDecorator(newSingleThreadScheduledExecutor(groupedThreads("MastershipLoadBalancer", "%d", log))); |
91 | 92 | ||
92 | @Activate | 93 | @Activate |
93 | public void activate() { | 94 | public void activate() { | ... | ... |
... | @@ -126,7 +126,7 @@ public class OpenstackInterfaceManager implements OpenstackInterfaceService { | ... | @@ -126,7 +126,7 @@ public class OpenstackInterfaceManager implements OpenstackInterfaceService { |
126 | 126 | ||
127 | private InternalConfigListener internalConfigListener = new InternalConfigListener(); | 127 | private InternalConfigListener internalConfigListener = new InternalConfigListener(); |
128 | private ExecutorService networkEventExcutorService = | 128 | private ExecutorService networkEventExcutorService = |
129 | - Executors.newSingleThreadExecutor(groupedThreads("onos/openstackinterface", "config-event")); | 129 | + Executors.newSingleThreadExecutor(groupedThreads("onos/openstackinterface", "config-event", log)); |
130 | 130 | ||
131 | private final Set<ConfigFactory> factories = ImmutableSet.of( | 131 | private final Set<ConfigFactory> factories = ImmutableSet.of( |
132 | new ConfigFactory<ApplicationId, OpenstackInterfaceConfig>(APP_SUBJECT_FACTORY, | 132 | new ConfigFactory<ApplicationId, OpenstackInterfaceConfig>(APP_SUBJECT_FACTORY, |
... | @@ -293,6 +293,7 @@ public class OpenstackInterfaceManager implements OpenstackInterfaceService { | ... | @@ -293,6 +293,7 @@ public class OpenstackInterfaceManager implements OpenstackInterfaceService { |
293 | * @param id Security Group ID | 293 | * @param id Security Group ID |
294 | * @return OpenstackSecurityGroup object or null if fails | 294 | * @return OpenstackSecurityGroup object or null if fails |
295 | */ | 295 | */ |
296 | + @Override | ||
296 | public OpenstackSecurityGroup securityGroup(String id) { | 297 | public OpenstackSecurityGroup securityGroup(String id) { |
297 | Invocation.Builder builder = getClientBuilder(neutronUrl, URI_SECURITY_GROUPS + "/" + id); | 298 | Invocation.Builder builder = getClientBuilder(neutronUrl, URI_SECURITY_GROUPS + "/" + id); |
298 | if (builder == null) { | 299 | if (builder == null) { | ... | ... |
... | @@ -31,6 +31,8 @@ import org.onlab.packet.IpPrefix; | ... | @@ -31,6 +31,8 @@ import org.onlab.packet.IpPrefix; |
31 | import org.slf4j.Logger; | 31 | import org.slf4j.Logger; |
32 | import org.slf4j.LoggerFactory; | 32 | import org.slf4j.LoggerFactory; |
33 | 33 | ||
34 | +import static org.onlab.util.Tools.groupedThreads; | ||
35 | + | ||
34 | import java.net.InetAddress; | 36 | import java.net.InetAddress; |
35 | import java.net.InetSocketAddress; | 37 | import java.net.InetSocketAddress; |
36 | import java.util.Collection; | 38 | import java.util.Collection; |
... | @@ -58,7 +60,7 @@ public class BgpSession extends SimpleChannelHandler { | ... | @@ -58,7 +60,7 @@ public class BgpSession extends SimpleChannelHandler { |
58 | private final BgpSessionInfo remoteInfo; // BGP session remote info | 60 | private final BgpSessionInfo remoteInfo; // BGP session remote info |
59 | 61 | ||
60 | // Timers state | 62 | // Timers state |
61 | - private Timer timer = new HashedWheelTimer(); | 63 | + private Timer timer = new HashedWheelTimer(groupedThreads("BgpSession", "timer-%d", log)); |
62 | private volatile Timeout keepaliveTimeout; // Periodic KEEPALIVE | 64 | private volatile Timeout keepaliveTimeout; // Periodic KEEPALIVE |
63 | private volatile Timeout sessionTimeout; // Session timeout | 65 | private volatile Timeout sessionTimeout; // Session timeout |
64 | 66 | ... | ... |
... | @@ -136,6 +136,7 @@ public class BgpSessionManager implements BgpInfoService { | ... | @@ -136,6 +136,7 @@ public class BgpSessionManager implements BgpInfoService { |
136 | * | 136 | * |
137 | * @return the BGP sessions | 137 | * @return the BGP sessions |
138 | */ | 138 | */ |
139 | + @Override | ||
139 | public Collection<BgpSession> getBgpSessions() { | 140 | public Collection<BgpSession> getBgpSessions() { |
140 | return bgpSessions.values(); | 141 | return bgpSessions.values(); |
141 | } | 142 | } |
... | @@ -145,6 +146,7 @@ public class BgpSessionManager implements BgpInfoService { | ... | @@ -145,6 +146,7 @@ public class BgpSessionManager implements BgpInfoService { |
145 | * | 146 | * |
146 | * @return the selected IPv4 BGP routes among all BGP sessions | 147 | * @return the selected IPv4 BGP routes among all BGP sessions |
147 | */ | 148 | */ |
149 | + @Override | ||
148 | public Collection<BgpRouteEntry> getBgpRoutes4() { | 150 | public Collection<BgpRouteEntry> getBgpRoutes4() { |
149 | return bgpRoutes4.values(); | 151 | return bgpRoutes4.values(); |
150 | } | 152 | } |
... | @@ -154,6 +156,7 @@ public class BgpSessionManager implements BgpInfoService { | ... | @@ -154,6 +156,7 @@ public class BgpSessionManager implements BgpInfoService { |
154 | * | 156 | * |
155 | * @return the selected IPv6 BGP routes among all BGP sessions | 157 | * @return the selected IPv6 BGP routes among all BGP sessions |
156 | */ | 158 | */ |
159 | + @Override | ||
157 | public Collection<BgpRouteEntry> getBgpRoutes6() { | 160 | public Collection<BgpRouteEntry> getBgpRoutes6() { |
158 | return bgpRoutes6.values(); | 161 | return bgpRoutes6.values(); |
159 | } | 162 | } |
... | @@ -309,8 +312,8 @@ public class BgpSessionManager implements BgpInfoService { | ... | @@ -309,8 +312,8 @@ public class BgpSessionManager implements BgpInfoService { |
309 | isShutdown = false; | 312 | isShutdown = false; |
310 | 313 | ||
311 | ChannelFactory channelFactory = new NioServerSocketChannelFactory( | 314 | ChannelFactory channelFactory = new NioServerSocketChannelFactory( |
312 | - newCachedThreadPool(groupedThreads("onos/bgp", "sm-boss-%d")), | 315 | + newCachedThreadPool(groupedThreads("onos/bgp", "sm-boss-%d", log)), |
313 | - newCachedThreadPool(groupedThreads("onos/bgp", "sm-worker-%d"))); | 316 | + newCachedThreadPool(groupedThreads("onos/bgp", "sm-worker-%d", log))); |
314 | ChannelPipelineFactory pipelineFactory = () -> { | 317 | ChannelPipelineFactory pipelineFactory = () -> { |
315 | // Allocate a new session per connection | 318 | // Allocate a new session per connection |
316 | BgpSession bgpSessionHandler = | 319 | BgpSession bgpSessionHandler = | ... | ... |
... | @@ -121,8 +121,8 @@ public class FpmManager implements FpmInfoService { | ... | @@ -121,8 +121,8 @@ public class FpmManager implements FpmInfoService { |
121 | 121 | ||
122 | private void startServer() { | 122 | private void startServer() { |
123 | ChannelFactory channelFactory = new NioServerSocketChannelFactory( | 123 | ChannelFactory channelFactory = new NioServerSocketChannelFactory( |
124 | - newCachedThreadPool(groupedThreads("onos/fpm", "sm-boss-%d")), | 124 | + newCachedThreadPool(groupedThreads("onos/fpm", "sm-boss-%d", log)), |
125 | - newCachedThreadPool(groupedThreads("onos/fpm", "sm-worker-%d"))); | 125 | + newCachedThreadPool(groupedThreads("onos/fpm", "sm-worker-%d", log))); |
126 | ChannelPipelineFactory pipelineFactory = () -> { | 126 | ChannelPipelineFactory pipelineFactory = () -> { |
127 | // Allocate a new session per connection | 127 | // Allocate a new session per connection |
128 | FpmSessionHandler fpmSessionHandler = | 128 | FpmSessionHandler fpmSessionHandler = | ... | ... |
... | @@ -30,11 +30,13 @@ import org.onosproject.segmentrouting.config.DeviceConfiguration; | ... | @@ -30,11 +30,13 @@ import org.onosproject.segmentrouting.config.DeviceConfiguration; |
30 | import org.slf4j.Logger; | 30 | import org.slf4j.Logger; |
31 | import org.slf4j.LoggerFactory; | 31 | import org.slf4j.LoggerFactory; |
32 | 32 | ||
33 | +import static java.util.concurrent.Executors.newScheduledThreadPool; | ||
34 | +import static org.onlab.util.Tools.groupedThreads; | ||
35 | + | ||
33 | import java.util.ArrayList; | 36 | import java.util.ArrayList; |
34 | import java.util.HashMap; | 37 | import java.util.HashMap; |
35 | import java.util.HashSet; | 38 | import java.util.HashSet; |
36 | import java.util.Set; | 39 | import java.util.Set; |
37 | -import java.util.concurrent.Executors; | ||
38 | import java.util.concurrent.ScheduledExecutorService; | 40 | import java.util.concurrent.ScheduledExecutorService; |
39 | import java.util.concurrent.TimeUnit; | 41 | import java.util.concurrent.TimeUnit; |
40 | import java.util.concurrent.locks.Lock; | 42 | import java.util.concurrent.locks.Lock; |
... | @@ -58,7 +60,8 @@ public class DefaultRoutingHandler { | ... | @@ -58,7 +60,8 @@ public class DefaultRoutingHandler { |
58 | private DeviceConfiguration config; | 60 | private DeviceConfiguration config; |
59 | private final Lock statusLock = new ReentrantLock(); | 61 | private final Lock statusLock = new ReentrantLock(); |
60 | private volatile Status populationStatus; | 62 | private volatile Status populationStatus; |
61 | - private ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); | 63 | + private ScheduledExecutorService executorService |
64 | + = newScheduledThreadPool(1, groupedThreads("RoutingHandler", "retry-%d", log)); | ||
62 | 65 | ||
63 | /** | 66 | /** |
64 | * Represents the default routing population status. | 67 | * Represents the default routing population status. | ... | ... |
... | @@ -102,6 +102,7 @@ import java.util.concurrent.ScheduledFuture; | ... | @@ -102,6 +102,7 @@ import java.util.concurrent.ScheduledFuture; |
102 | import java.util.concurrent.TimeUnit; | 102 | import java.util.concurrent.TimeUnit; |
103 | 103 | ||
104 | import static com.google.common.base.Preconditions.checkState; | 104 | import static com.google.common.base.Preconditions.checkState; |
105 | +import static org.onlab.util.Tools.groupedThreads; | ||
105 | 106 | ||
106 | 107 | ||
107 | /** | 108 | /** |
... | @@ -178,12 +179,12 @@ public class SegmentRoutingManager implements SegmentRoutingService { | ... | @@ -178,12 +179,12 @@ public class SegmentRoutingManager implements SegmentRoutingService { |
178 | private final InternalCordConfigListener cordConfigListener = new InternalCordConfigListener(); | 179 | private final InternalCordConfigListener cordConfigListener = new InternalCordConfigListener(); |
179 | 180 | ||
180 | private ScheduledExecutorService executorService = Executors | 181 | private ScheduledExecutorService executorService = Executors |
181 | - .newScheduledThreadPool(1); | 182 | + .newScheduledThreadPool(1, groupedThreads("SegmentRoutingManager", "event-%d", log)); |
182 | 183 | ||
183 | @SuppressWarnings("unused") | 184 | @SuppressWarnings("unused") |
184 | private static ScheduledFuture<?> eventHandlerFuture = null; | 185 | private static ScheduledFuture<?> eventHandlerFuture = null; |
185 | @SuppressWarnings("rawtypes") | 186 | @SuppressWarnings("rawtypes") |
186 | - private ConcurrentLinkedQueue<Event> eventQueue = new ConcurrentLinkedQueue<Event>(); | 187 | + private ConcurrentLinkedQueue<Event> eventQueue = new ConcurrentLinkedQueue<>(); |
187 | private Map<DeviceId, DefaultGroupHandler> groupHandlerMap = | 188 | private Map<DeviceId, DefaultGroupHandler> groupHandlerMap = |
188 | new ConcurrentHashMap<>(); | 189 | new ConcurrentHashMap<>(); |
189 | /** | 190 | /** |
... | @@ -712,7 +713,7 @@ public class SegmentRoutingManager implements SegmentRoutingService { | ... | @@ -712,7 +713,7 @@ public class SegmentRoutingManager implements SegmentRoutingService { |
712 | } else if (event.type() == DeviceEvent.Type.PORT_ADDED || | 713 | } else if (event.type() == DeviceEvent.Type.PORT_ADDED || |
713 | event.type() == DeviceEvent.Type.PORT_UPDATED) { | 714 | event.type() == DeviceEvent.Type.PORT_UPDATED) { |
714 | log.info("** PORT ADDED OR UPDATED {}/{} -> {}", | 715 | log.info("** PORT ADDED OR UPDATED {}/{} -> {}", |
715 | - (Device) event.subject(), | 716 | + event.subject(), |
716 | ((DeviceEvent) event).port(), | 717 | ((DeviceEvent) event).port(), |
717 | event.type()); | 718 | event.type()); |
718 | /* XXX create method for single port filtering rules | 719 | /* XXX create method for single port filtering rules | ... | ... |
... | @@ -25,7 +25,6 @@ import java.io.InputStream; | ... | @@ -25,7 +25,6 @@ import java.io.InputStream; |
25 | import java.net.URL; | 25 | import java.net.URL; |
26 | import java.net.URLConnection; | 26 | import java.net.URLConnection; |
27 | import java.util.Set; | 27 | import java.util.Set; |
28 | -import java.util.concurrent.Executors; | ||
29 | import java.util.concurrent.ScheduledExecutorService; | 28 | import java.util.concurrent.ScheduledExecutorService; |
30 | import java.util.concurrent.TimeUnit; | 29 | import java.util.concurrent.TimeUnit; |
31 | import java.util.concurrent.atomic.AtomicReference; | 30 | import java.util.concurrent.atomic.AtomicReference; |
... | @@ -65,6 +64,7 @@ import com.google.common.collect.Sets; | ... | @@ -65,6 +64,7 @@ import com.google.common.collect.Sets; |
65 | import com.google.common.io.Files; | 64 | import com.google.common.io.Files; |
66 | 65 | ||
67 | import static com.google.common.base.Preconditions.checkState; | 66 | import static com.google.common.base.Preconditions.checkState; |
67 | +import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | ||
68 | 68 | ||
69 | /** | 69 | /** |
70 | * Provider of {@link ClusterMetadata cluster metadata} sourced from a local config file. | 70 | * Provider of {@link ClusterMetadata cluster metadata} sourced from a local config file. |
... | @@ -89,7 +89,7 @@ public class ConfigFileBasedClusterMetadataProvider implements ClusterMetadataPr | ... | @@ -89,7 +89,7 @@ public class ConfigFileBasedClusterMetadataProvider implements ClusterMetadataPr |
89 | private static final ProviderId PROVIDER_ID = new ProviderId("file", "none"); | 89 | private static final ProviderId PROVIDER_ID = new ProviderId("file", "none"); |
90 | private final AtomicReference<Versioned<ClusterMetadata>> cachedMetadata = new AtomicReference<>(); | 90 | private final AtomicReference<Versioned<ClusterMetadata>> cachedMetadata = new AtomicReference<>(); |
91 | private final ScheduledExecutorService configFileChangeDetector = | 91 | private final ScheduledExecutorService configFileChangeDetector = |
92 | - Executors.newSingleThreadScheduledExecutor(groupedThreads("onos/cluster/metadata/config-watcher", "")); | 92 | + newSingleThreadScheduledExecutor(groupedThreads("onos/cluster/metadata/config-watcher", "", log)); |
93 | 93 | ||
94 | private String metadataUrl; | 94 | private String metadataUrl; |
95 | private ObjectMapper mapper; | 95 | private ObjectMapper mapper; | ... | ... |
... | @@ -42,12 +42,13 @@ import org.slf4j.LoggerFactory; | ... | @@ -42,12 +42,13 @@ import org.slf4j.LoggerFactory; |
42 | 42 | ||
43 | import java.util.Collection; | 43 | import java.util.Collection; |
44 | import java.util.Set; | 44 | import java.util.Set; |
45 | -import java.util.concurrent.Executors; | ||
46 | import java.util.concurrent.ScheduledExecutorService; | 45 | import java.util.concurrent.ScheduledExecutorService; |
47 | import java.util.concurrent.ScheduledFuture; | 46 | import java.util.concurrent.ScheduledFuture; |
48 | import java.util.concurrent.TimeUnit; | 47 | import java.util.concurrent.TimeUnit; |
49 | 48 | ||
50 | import static com.google.common.collect.ImmutableSet.copyOf; | 49 | import static com.google.common.collect.ImmutableSet.copyOf; |
50 | +import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | ||
51 | +import static org.onlab.util.Tools.groupedThreads; | ||
51 | import static org.onosproject.net.device.DeviceEvent.Type.*; | 52 | import static org.onosproject.net.device.DeviceEvent.Type.*; |
52 | import static org.onosproject.net.flow.FlowRuleBatchEntry.FlowRuleOperation.*; | 53 | import static org.onosproject.net.flow.FlowRuleBatchEntry.FlowRuleOperation.*; |
53 | 54 | ||
... | @@ -67,7 +68,8 @@ class FlowRuleDriverProvider extends AbstractProvider implements FlowRuleProvide | ... | @@ -67,7 +68,8 @@ class FlowRuleDriverProvider extends AbstractProvider implements FlowRuleProvide |
67 | private MastershipService mastershipService; | 68 | private MastershipService mastershipService; |
68 | 69 | ||
69 | private InternalDeviceListener deviceListener = new InternalDeviceListener(); | 70 | private InternalDeviceListener deviceListener = new InternalDeviceListener(); |
70 | - private ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); | 71 | + private ScheduledExecutorService executor |
72 | + = newSingleThreadScheduledExecutor(groupedThreads("FlowRuleDriverProvider", "%d", log)); | ||
71 | private ScheduledFuture<?> poller = null; | 73 | private ScheduledFuture<?> poller = null; |
72 | 74 | ||
73 | /** | 75 | /** | ... | ... |
... | @@ -145,7 +145,7 @@ public class FlowObjectiveCompositionManager implements FlowObjectiveService { | ... | @@ -145,7 +145,7 @@ public class FlowObjectiveCompositionManager implements FlowObjectiveService { |
145 | 145 | ||
146 | @Activate | 146 | @Activate |
147 | protected void activate() { | 147 | protected void activate() { |
148 | - executorService = newFixedThreadPool(4, groupedThreads("onos/objective-installer", "%d")); | 148 | + executorService = newFixedThreadPool(4, groupedThreads("onos/objective-installer", "%d", log)); |
149 | flowObjectiveStore.setDelegate(delegate); | 149 | flowObjectiveStore.setDelegate(delegate); |
150 | mastershipService.addListener(mastershipListener); | 150 | mastershipService.addListener(mastershipListener); |
151 | deviceService.addListener(deviceListener); | 151 | deviceService.addListener(deviceListener); | ... | ... |
... | @@ -61,7 +61,6 @@ import java.util.HashSet; | ... | @@ -61,7 +61,6 @@ import java.util.HashSet; |
61 | import java.util.List; | 61 | import java.util.List; |
62 | import java.util.Set; | 62 | import java.util.Set; |
63 | import java.util.concurrent.ExecutorService; | 63 | import java.util.concurrent.ExecutorService; |
64 | -import java.util.concurrent.Executors; | ||
65 | import java.util.concurrent.ScheduledExecutorService; | 64 | import java.util.concurrent.ScheduledExecutorService; |
66 | import java.util.concurrent.TimeUnit; | 65 | import java.util.concurrent.TimeUnit; |
67 | import java.util.concurrent.atomic.AtomicBoolean; | 66 | import java.util.concurrent.atomic.AtomicBoolean; |
... | @@ -69,6 +68,7 @@ import java.util.concurrent.atomic.AtomicBoolean; | ... | @@ -69,6 +68,7 @@ import java.util.concurrent.atomic.AtomicBoolean; |
69 | import static com.google.common.base.Preconditions.checkArgument; | 68 | import static com.google.common.base.Preconditions.checkArgument; |
70 | import static com.google.common.base.Preconditions.checkNotNull; | 69 | import static com.google.common.base.Preconditions.checkNotNull; |
71 | import static com.google.common.collect.Multimaps.synchronizedSetMultimap; | 70 | import static com.google.common.collect.Multimaps.synchronizedSetMultimap; |
71 | +import static java.util.concurrent.Executors.newScheduledThreadPool; | ||
72 | import static java.util.concurrent.Executors.newSingleThreadExecutor; | 72 | import static java.util.concurrent.Executors.newSingleThreadExecutor; |
73 | import static org.onlab.util.Tools.groupedThreads; | 73 | import static org.onlab.util.Tools.groupedThreads; |
74 | import static org.onlab.util.Tools.isNullOrEmpty; | 74 | import static org.onlab.util.Tools.isNullOrEmpty; |
... | @@ -117,8 +117,8 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -117,8 +117,8 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
117 | 117 | ||
118 | private ExecutorService executorService = | 118 | private ExecutorService executorService = |
119 | newSingleThreadExecutor(groupedThreads("onos/intent", "objectivetracker", log)); | 119 | newSingleThreadExecutor(groupedThreads("onos/intent", "objectivetracker", log)); |
120 | - private ScheduledExecutorService executor = Executors | 120 | + private ScheduledExecutorService executor = |
121 | - .newScheduledThreadPool(1); | 121 | + newScheduledThreadPool(1, groupedThreads("onos/intent", "scheduledIntentUpdate", log)); |
122 | 122 | ||
123 | private TopologyListener listener = new InternalTopologyListener(); | 123 | private TopologyListener listener = new InternalTopologyListener(); |
124 | private ResourceListener resourceListener = new InternalResourceListener(); | 124 | private ResourceListener resourceListener = new InternalResourceListener(); | ... | ... |
... | @@ -29,7 +29,6 @@ import org.apache.karaf.features.BundleInfo; | ... | @@ -29,7 +29,6 @@ import org.apache.karaf.features.BundleInfo; |
29 | import org.apache.karaf.features.Feature; | 29 | import org.apache.karaf.features.Feature; |
30 | import org.apache.karaf.features.FeaturesService; | 30 | import org.apache.karaf.features.FeaturesService; |
31 | import org.onlab.util.KryoNamespace; | 31 | import org.onlab.util.KryoNamespace; |
32 | -import org.onlab.util.Tools; | ||
33 | import org.onosproject.app.ApplicationAdminService; | 32 | import org.onosproject.app.ApplicationAdminService; |
34 | import org.onosproject.core.Application; | 33 | import org.onosproject.core.Application; |
35 | import org.onosproject.core.ApplicationId; | 34 | import org.onosproject.core.ApplicationId; |
... | @@ -50,9 +49,10 @@ import java.util.Objects; | ... | @@ -50,9 +49,10 @@ import java.util.Objects; |
50 | import java.util.Set; | 49 | import java.util.Set; |
51 | import java.util.concurrent.ConcurrentHashMap; | 50 | import java.util.concurrent.ConcurrentHashMap; |
52 | import java.util.concurrent.ExecutorService; | 51 | import java.util.concurrent.ExecutorService; |
53 | -import java.util.concurrent.Executors; | ||
54 | import java.util.stream.Collectors; | 52 | import java.util.stream.Collectors; |
55 | 53 | ||
54 | +import static java.util.concurrent.Executors.newSingleThreadExecutor; | ||
55 | +import static org.onlab.util.Tools.groupedThreads; | ||
56 | import static org.onosproject.security.store.SecurityModeState.*; | 56 | import static org.onosproject.security.store.SecurityModeState.*; |
57 | import static org.slf4j.LoggerFactory.getLogger; | 57 | import static org.slf4j.LoggerFactory.getLogger; |
58 | 58 | ||
... | @@ -102,7 +102,7 @@ public class DistributedSecurityModeStore | ... | @@ -102,7 +102,7 @@ public class DistributedSecurityModeStore |
102 | 102 | ||
103 | @Activate | 103 | @Activate |
104 | public void activate() { | 104 | public void activate() { |
105 | - eventHandler = Executors.newSingleThreadExecutor(Tools.groupedThreads("onos/security/store", "event-handler")); | 105 | + eventHandler = newSingleThreadExecutor(groupedThreads("onos/security/store", "event-handler", log)); |
106 | states = storageService.<ApplicationId, SecurityInfo>consistentMapBuilder() | 106 | states = storageService.<ApplicationId, SecurityInfo>consistentMapBuilder() |
107 | .withName("smonos-sdata") | 107 | .withName("smonos-sdata") |
108 | .withSerializer(STATE_SERIALIZER) | 108 | .withSerializer(STATE_SERIALIZER) | ... | ... |
... | @@ -36,6 +36,8 @@ import org.onosproject.net.intent.Key; | ... | @@ -36,6 +36,8 @@ import org.onosproject.net.intent.Key; |
36 | import org.slf4j.Logger; | 36 | import org.slf4j.Logger; |
37 | import org.slf4j.LoggerFactory; | 37 | import org.slf4j.LoggerFactory; |
38 | 38 | ||
39 | +import static org.onlab.util.Tools.groupedThreads; | ||
40 | + | ||
39 | import java.util.List; | 41 | import java.util.List; |
40 | import java.util.Objects; | 42 | import java.util.Objects; |
41 | import java.util.concurrent.Executors; | 43 | import java.util.concurrent.Executors; |
... | @@ -77,7 +79,7 @@ public class IntentPartitionManager implements IntentPartitionService { | ... | @@ -77,7 +79,7 @@ public class IntentPartitionManager implements IntentPartitionService { |
77 | private LeadershipEventListener leaderListener = new InternalLeadershipListener(); | 79 | private LeadershipEventListener leaderListener = new InternalLeadershipListener(); |
78 | 80 | ||
79 | private ScheduledExecutorService executor = Executors | 81 | private ScheduledExecutorService executor = Executors |
80 | - .newScheduledThreadPool(1); | 82 | + .newScheduledThreadPool(1, groupedThreads("IntentPartition", "balancer-%d", log)); |
81 | 83 | ||
82 | @Activate | 84 | @Activate |
83 | public void activate() { | 85 | public void activate() { | ... | ... |
... | @@ -57,6 +57,7 @@ import java.util.concurrent.atomic.AtomicBoolean; | ... | @@ -57,6 +57,7 @@ import java.util.concurrent.atomic.AtomicBoolean; |
57 | 57 | ||
58 | import static com.google.common.base.Preconditions.checkArgument; | 58 | import static com.google.common.base.Preconditions.checkArgument; |
59 | import static com.google.common.base.Strings.isNullOrEmpty; | 59 | import static com.google.common.base.Strings.isNullOrEmpty; |
60 | +import static java.util.concurrent.Executors.newFixedThreadPool; | ||
60 | import static org.onlab.util.Tools.get; | 61 | import static org.onlab.util.Tools.get; |
61 | import static org.onlab.util.Tools.groupedThreads; | 62 | import static org.onlab.util.Tools.groupedThreads; |
62 | import static org.slf4j.LoggerFactory.getLogger; | 63 | import static org.slf4j.LoggerFactory.getLogger; |
... | @@ -284,7 +285,8 @@ public class DistributedPacketStore | ... | @@ -284,7 +285,8 @@ public class DistributedPacketStore |
284 | */ | 285 | */ |
285 | private void restartMessageHandlerThreadPool() { | 286 | private void restartMessageHandlerThreadPool() { |
286 | ExecutorService prevExecutor = messageHandlingExecutor; | 287 | ExecutorService prevExecutor = messageHandlingExecutor; |
287 | - messageHandlingExecutor = Executors.newFixedThreadPool(getMessageHandlerThreadPoolSize()); | 288 | + messageHandlingExecutor = newFixedThreadPool(getMessageHandlerThreadPoolSize(), |
289 | + groupedThreads("DistPktStore", "messageHandling-%d", log)); | ||
288 | prevExecutor.shutdown(); | 290 | prevExecutor.shutdown(); |
289 | } | 291 | } |
290 | 292 | ... | ... |
... | @@ -59,6 +59,7 @@ import java.util.concurrent.TimeUnit; | ... | @@ -59,6 +59,7 @@ import java.util.concurrent.TimeUnit; |
59 | 59 | ||
60 | import static com.google.common.base.Preconditions.checkArgument; | 60 | import static com.google.common.base.Preconditions.checkArgument; |
61 | import static com.google.common.base.Strings.isNullOrEmpty; | 61 | import static com.google.common.base.Strings.isNullOrEmpty; |
62 | +import static java.util.concurrent.Executors.newFixedThreadPool; | ||
62 | import static org.onlab.util.Tools.get; | 63 | import static org.onlab.util.Tools.get; |
63 | import static org.onlab.util.Tools.groupedThreads; | 64 | import static org.onlab.util.Tools.groupedThreads; |
64 | import static org.slf4j.LoggerFactory.getLogger; | 65 | import static org.slf4j.LoggerFactory.getLogger; |
... | @@ -338,7 +339,8 @@ public class DistributedFlowStatisticStore implements FlowStatisticStore { | ... | @@ -338,7 +339,8 @@ public class DistributedFlowStatisticStore implements FlowStatisticStore { |
338 | */ | 339 | */ |
339 | private void restartMessageHandlerThreadPool() { | 340 | private void restartMessageHandlerThreadPool() { |
340 | ExecutorService prevExecutor = messageHandlingExecutor; | 341 | ExecutorService prevExecutor = messageHandlingExecutor; |
341 | - messageHandlingExecutor = Executors.newFixedThreadPool(getMessageHandlerThreadPoolSize()); | 342 | + messageHandlingExecutor = newFixedThreadPool(getMessageHandlerThreadPoolSize(), |
343 | + groupedThreads("DistFlowStats", "messageHandling-%d", log)); | ||
342 | prevExecutor.shutdown(); | 344 | prevExecutor.shutdown(); |
343 | } | 345 | } |
344 | 346 | ... | ... |
... | @@ -58,6 +58,7 @@ import java.util.concurrent.atomic.AtomicInteger; | ... | @@ -58,6 +58,7 @@ import java.util.concurrent.atomic.AtomicInteger; |
58 | 58 | ||
59 | import static com.google.common.base.Preconditions.checkArgument; | 59 | import static com.google.common.base.Preconditions.checkArgument; |
60 | import static com.google.common.base.Strings.isNullOrEmpty; | 60 | import static com.google.common.base.Strings.isNullOrEmpty; |
61 | +import static java.util.concurrent.Executors.newFixedThreadPool; | ||
61 | import static org.onlab.util.Tools.get; | 62 | import static org.onlab.util.Tools.get; |
62 | import static org.onlab.util.Tools.groupedThreads; | 63 | import static org.onlab.util.Tools.groupedThreads; |
63 | import static org.slf4j.LoggerFactory.getLogger; | 64 | import static org.slf4j.LoggerFactory.getLogger; |
... | @@ -357,7 +358,8 @@ public class DistributedStatisticStore implements StatisticStore { | ... | @@ -357,7 +358,8 @@ public class DistributedStatisticStore implements StatisticStore { |
357 | */ | 358 | */ |
358 | private void restartMessageHandlerThreadPool() { | 359 | private void restartMessageHandlerThreadPool() { |
359 | ExecutorService prevExecutor = messageHandlingExecutor; | 360 | ExecutorService prevExecutor = messageHandlingExecutor; |
360 | - messageHandlingExecutor = Executors.newFixedThreadPool(getMessageHandlerThreadPoolSize()); | 361 | + messageHandlingExecutor = newFixedThreadPool(getMessageHandlerThreadPoolSize(), |
362 | + groupedThreads("DistStatsStore", "messageHandling-%d", log)); | ||
361 | prevExecutor.shutdown(); | 363 | prevExecutor.shutdown(); |
362 | } | 364 | } |
363 | 365 | ... | ... |
... | @@ -15,12 +15,13 @@ | ... | @@ -15,12 +15,13 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.store.primitives.impl; | 16 | package org.onosproject.store.primitives.impl; |
17 | 17 | ||
18 | +import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | ||
19 | +import static org.onlab.util.Tools.groupedThreads; | ||
18 | import static org.slf4j.LoggerFactory.getLogger; | 20 | import static org.slf4j.LoggerFactory.getLogger; |
19 | 21 | ||
20 | import java.net.ConnectException; | 22 | import java.net.ConnectException; |
21 | import java.nio.channels.ClosedChannelException; | 23 | import java.nio.channels.ClosedChannelException; |
22 | import java.util.concurrent.CompletableFuture; | 24 | import java.util.concurrent.CompletableFuture; |
23 | -import java.util.concurrent.Executors; | ||
24 | import java.util.concurrent.ScheduledExecutorService; | 25 | import java.util.concurrent.ScheduledExecutorService; |
25 | import java.util.concurrent.TimeUnit; | 26 | import java.util.concurrent.TimeUnit; |
26 | import java.util.concurrent.TimeoutException; | 27 | import java.util.concurrent.TimeoutException; |
... | @@ -62,7 +63,7 @@ public class OnosCopycatClient extends DelegatingCopycatClient { | ... | @@ -62,7 +63,7 @@ public class OnosCopycatClient extends DelegatingCopycatClient { |
62 | super(client); | 63 | super(client); |
63 | this.maxRetries = maxRetries; | 64 | this.maxRetries = maxRetries; |
64 | this.delayBetweenRetriesMillis = delayBetweenRetriesMillis; | 65 | this.delayBetweenRetriesMillis = delayBetweenRetriesMillis; |
65 | - this.executor = Executors.newSingleThreadScheduledExecutor(); | 66 | + this.executor = newSingleThreadScheduledExecutor(groupedThreads("OnosCopycat", "client", log)); |
66 | } | 67 | } |
67 | 68 | ||
68 | @Override | 69 | @Override | ... | ... |
... | @@ -15,6 +15,8 @@ | ... | @@ -15,6 +15,8 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.store.primitives.resources.impl; | 16 | package org.onosproject.store.primitives.resources.impl; |
17 | 17 | ||
18 | +import static java.util.concurrent.Executors.newSingleThreadExecutor; | ||
19 | +import static org.onlab.util.Tools.groupedThreads; | ||
18 | import static org.slf4j.LoggerFactory.getLogger; | 20 | import static org.slf4j.LoggerFactory.getLogger; |
19 | 21 | ||
20 | import java.util.Collection; | 22 | import java.util.Collection; |
... | @@ -24,7 +26,6 @@ import java.util.Timer; | ... | @@ -24,7 +26,6 @@ import java.util.Timer; |
24 | import java.util.concurrent.CompletableFuture; | 26 | import java.util.concurrent.CompletableFuture; |
25 | import java.util.concurrent.Executor; | 27 | import java.util.concurrent.Executor; |
26 | import java.util.concurrent.ExecutorService; | 28 | import java.util.concurrent.ExecutorService; |
27 | -import java.util.concurrent.Executors; | ||
28 | import java.util.concurrent.atomic.AtomicBoolean; | 29 | import java.util.concurrent.atomic.AtomicBoolean; |
29 | import java.util.concurrent.atomic.AtomicInteger; | 30 | import java.util.concurrent.atomic.AtomicInteger; |
30 | import java.util.concurrent.atomic.AtomicReference; | 31 | import java.util.concurrent.atomic.AtomicReference; |
... | @@ -58,7 +59,7 @@ public class AtomixWorkQueue extends AbstractResource<AtomixWorkQueue> | ... | @@ -58,7 +59,7 @@ public class AtomixWorkQueue extends AbstractResource<AtomixWorkQueue> |
58 | 59 | ||
59 | private final Logger log = getLogger(getClass()); | 60 | private final Logger log = getLogger(getClass()); |
60 | public static final String TASK_AVAILABLE = "task-available"; | 61 | public static final String TASK_AVAILABLE = "task-available"; |
61 | - private final ExecutorService executor = Executors.newSingleThreadExecutor(); | 62 | + private final ExecutorService executor = newSingleThreadExecutor(groupedThreads("AtomixWorkQueue", "%d", log)); |
62 | private final AtomicReference<TaskProcessor> taskProcessor = new AtomicReference<>(); | 63 | private final AtomicReference<TaskProcessor> taskProcessor = new AtomicReference<>(); |
63 | private final Timer timer = new Timer("atomix-work-queue-completer"); | 64 | private final Timer timer = new Timer("atomix-work-queue-completer"); |
64 | private final AtomicBoolean isRegistered = new AtomicBoolean(false); | 65 | private final AtomicBoolean isRegistered = new AtomicBoolean(false); | ... | ... |
... | @@ -111,7 +111,7 @@ public abstract class AbstractCorsaPipeline extends AbstractHandlerBehaviour imp | ... | @@ -111,7 +111,7 @@ public abstract class AbstractCorsaPipeline extends AbstractHandlerBehaviour imp |
111 | 111 | ||
112 | private ScheduledExecutorService groupChecker = | 112 | private ScheduledExecutorService groupChecker = |
113 | Executors.newScheduledThreadPool(2, groupedThreads("onos/pipeliner", | 113 | Executors.newScheduledThreadPool(2, groupedThreads("onos/pipeliner", |
114 | - "ovs-corsa-%d")); | 114 | + "ovs-corsa-%d", log)); |
115 | 115 | ||
116 | protected static final int CONTROLLER_PRIORITY = 255; | 116 | protected static final int CONTROLLER_PRIORITY = 255; |
117 | protected static final int DROP_PRIORITY = 0; | 117 | protected static final int DROP_PRIORITY = 0; | ... | ... |
... | @@ -62,7 +62,7 @@ public class ComponentManager implements ComponentService { | ... | @@ -62,7 +62,7 @@ public class ComponentManager implements ComponentService { |
62 | components = Sets.newSetFromMap(new ConcurrentHashMap<>()); | 62 | components = Sets.newSetFromMap(new ConcurrentHashMap<>()); |
63 | 63 | ||
64 | executor = Executors.newScheduledThreadPool(NUM_THREADS, | 64 | executor = Executors.newScheduledThreadPool(NUM_THREADS, |
65 | - groupedThreads("onos/component", "%d")); | 65 | + groupedThreads("onos/component", "%d", log)); |
66 | 66 | ||
67 | executor.scheduleAtFixedRate(() -> components.forEach(this::enableComponent), | 67 | executor.scheduleAtFixedRate(() -> components.forEach(this::enableComponent), |
68 | 0, POLLING_PERIOD_MS, TimeUnit.MILLISECONDS); | 68 | 0, POLLING_PERIOD_MS, TimeUnit.MILLISECONDS); | ... | ... |
... | @@ -85,7 +85,7 @@ public class RouteManager implements ListenerService<RouteEvent, RouteListener>, | ... | @@ -85,7 +85,7 @@ public class RouteManager implements ListenerService<RouteEvent, RouteListener>, |
85 | 85 | ||
86 | @Activate | 86 | @Activate |
87 | protected void activate() { | 87 | protected void activate() { |
88 | - threadFactory = groupedThreads("onos/route", "listener-%d"); | 88 | + threadFactory = groupedThreads("onos/route", "listener-%d", log); |
89 | 89 | ||
90 | routeStore.setDelegate(delegate); | 90 | routeStore.setDelegate(delegate); |
91 | hostService.addListener(hostListener); | 91 | hostService.addListener(hostListener); | ... | ... |
... | @@ -120,7 +120,8 @@ public class DistributedLabelResourceStore | ... | @@ -120,7 +120,8 @@ public class DistributedLabelResourceStore |
120 | messageHandlingExecutor = Executors | 120 | messageHandlingExecutor = Executors |
121 | .newFixedThreadPool(MESSAGE_HANDLER_THREAD_POOL_SIZE, | 121 | .newFixedThreadPool(MESSAGE_HANDLER_THREAD_POOL_SIZE, |
122 | groupedThreads("onos/store/flow", | 122 | groupedThreads("onos/store/flow", |
123 | - "message-handlers")); | 123 | + "message-handlers", |
124 | + log)); | ||
124 | clusterCommunicator | 125 | clusterCommunicator |
125 | .addSubscriber(LabelResourceMessageSubjects.LABEL_POOL_CREATED, | 126 | .addSubscriber(LabelResourceMessageSubjects.LABEL_POOL_CREATED, |
126 | SERIALIZER::<LabelResourcePool>decode, | 127 | SERIALIZER::<LabelResourcePool>decode, | ... | ... |
... | @@ -39,6 +39,8 @@ import io.netty.handler.timeout.IdleStateEvent; | ... | @@ -39,6 +39,8 @@ import io.netty.handler.timeout.IdleStateEvent; |
39 | import io.netty.handler.timeout.IdleStateHandler; | 39 | import io.netty.handler.timeout.IdleStateHandler; |
40 | import io.netty.util.CharsetUtil; | 40 | import io.netty.util.CharsetUtil; |
41 | 41 | ||
42 | +import static org.onlab.util.Tools.groupedThreads; | ||
43 | + | ||
42 | import java.net.InetSocketAddress; | 44 | import java.net.InetSocketAddress; |
43 | import java.util.concurrent.ExecutorService; | 45 | import java.util.concurrent.ExecutorService; |
44 | import java.util.concurrent.Executors; | 46 | import java.util.concurrent.Executors; |
... | @@ -47,6 +49,7 @@ import java.util.concurrent.atomic.AtomicInteger; | ... | @@ -47,6 +49,7 @@ import java.util.concurrent.atomic.AtomicInteger; |
47 | 49 | ||
48 | import org.onlab.packet.IpAddress; | 50 | import org.onlab.packet.IpAddress; |
49 | import org.onlab.packet.TpPort; | 51 | import org.onlab.packet.TpPort; |
52 | +import org.onlab.util.Tools; | ||
50 | import org.onosproject.ovsdb.controller.OvsdbConstant; | 53 | import org.onosproject.ovsdb.controller.OvsdbConstant; |
51 | import org.onosproject.ovsdb.controller.OvsdbNodeId; | 54 | import org.onosproject.ovsdb.controller.OvsdbNodeId; |
52 | import org.onosproject.ovsdb.controller.driver.DefaultOvsdbClient; | 55 | import org.onosproject.ovsdb.controller.driver.DefaultOvsdbClient; |
... | @@ -70,7 +73,7 @@ public class Controller { | ... | @@ -70,7 +73,7 @@ public class Controller { |
70 | private Callback monitorCallback; | 73 | private Callback monitorCallback; |
71 | 74 | ||
72 | private final ExecutorService executorService = Executors | 75 | private final ExecutorService executorService = Executors |
73 | - .newFixedThreadPool(10); | 76 | + .newFixedThreadPool(10, groupedThreads("OVSDB-C", "executor-%d", log)); |
74 | 77 | ||
75 | private EventLoopGroup bossGroup; | 78 | private EventLoopGroup bossGroup; |
76 | private EventLoopGroup workerGroup; | 79 | private EventLoopGroup workerGroup; |
... | @@ -83,8 +86,8 @@ public class Controller { | ... | @@ -83,8 +86,8 @@ public class Controller { |
83 | * Initialization. | 86 | * Initialization. |
84 | */ | 87 | */ |
85 | private void initEventLoopGroup() { | 88 | private void initEventLoopGroup() { |
86 | - bossGroup = new NioEventLoopGroup(); | 89 | + bossGroup = new NioEventLoopGroup(0, Tools.groupedThreads("OVSDB-C", "boss-%d", log)); |
87 | - workerGroup = new NioEventLoopGroup(); | 90 | + workerGroup = new NioEventLoopGroup(0, Tools.groupedThreads("OVSDB-C", "worker-%d", log)); |
88 | serverChannelClass = NioServerSocketChannel.class; | 91 | serverChannelClass = NioServerSocketChannel.class; |
89 | } | 92 | } |
90 | 93 | ||
... | @@ -118,6 +121,7 @@ public class Controller { | ... | @@ -118,6 +121,7 @@ public class Controller { |
118 | */ | 121 | */ |
119 | private class OnosCommunicationChannelInitializer | 122 | private class OnosCommunicationChannelInitializer |
120 | extends ChannelInitializer<SocketChannel> { | 123 | extends ChannelInitializer<SocketChannel> { |
124 | + @Override | ||
121 | protected void initChannel(SocketChannel channel) throws Exception { | 125 | protected void initChannel(SocketChannel channel) throws Exception { |
122 | log.info("New channel created"); | 126 | log.info("New channel created"); |
123 | channel.pipeline().addLast(new StringEncoder(CharsetUtil.UTF_8)); | 127 | channel.pipeline().addLast(new StringEncoder(CharsetUtil.UTF_8)); | ... | ... |
... | @@ -71,6 +71,7 @@ import java.util.concurrent.ScheduledExecutorService; | ... | @@ -71,6 +71,7 @@ import java.util.concurrent.ScheduledExecutorService; |
71 | import java.util.concurrent.ScheduledFuture; | 71 | import java.util.concurrent.ScheduledFuture; |
72 | import java.util.concurrent.TimeUnit; | 72 | import java.util.concurrent.TimeUnit; |
73 | 73 | ||
74 | +import static java.util.concurrent.Executors.newScheduledThreadPool; | ||
74 | import static org.onlab.util.Tools.groupedThreads; | 75 | import static org.onlab.util.Tools.groupedThreads; |
75 | import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY; | 76 | import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY; |
76 | import static org.slf4j.LoggerFactory.getLogger; | 77 | import static org.slf4j.LoggerFactory.getLogger; |
... | @@ -125,7 +126,10 @@ public class NetconfDeviceProvider extends AbstractProvider | ... | @@ -125,7 +126,10 @@ public class NetconfDeviceProvider extends AbstractProvider |
125 | private final ExecutorService executor = | 126 | private final ExecutorService executor = |
126 | Executors.newFixedThreadPool(5, groupedThreads("onos/netconfdeviceprovider", | 127 | Executors.newFixedThreadPool(5, groupedThreads("onos/netconfdeviceprovider", |
127 | "device-installer-%d", log)); | 128 | "device-installer-%d", log)); |
128 | - protected ScheduledExecutorService connectionExecutor = Executors.newScheduledThreadPool(CORE_POOL_SIZE); | 129 | + protected ScheduledExecutorService connectionExecutor |
130 | + = newScheduledThreadPool(CORE_POOL_SIZE, | ||
131 | + groupedThreads("onos/netconfdeviceprovider", | ||
132 | + "connection-executor-%d", log)); | ||
129 | 133 | ||
130 | private DeviceProviderService providerService; | 134 | private DeviceProviderService providerService; |
131 | private NetconfDeviceListener innerNodeListener = new InnerNetconfDeviceListener(); | 135 | private NetconfDeviceListener innerNodeListener = new InnerNetconfDeviceListener(); | ... | ... |
... | @@ -18,13 +18,14 @@ package org.onlab.util; | ... | @@ -18,13 +18,14 @@ package org.onlab.util; |
18 | import java.util.ArrayList; | 18 | import java.util.ArrayList; |
19 | import java.util.Collections; | 19 | import java.util.Collections; |
20 | import java.util.List; | 20 | import java.util.List; |
21 | -import java.util.concurrent.Executors; | ||
22 | import java.util.concurrent.ScheduledExecutorService; | 21 | import java.util.concurrent.ScheduledExecutorService; |
23 | import java.util.concurrent.TimeUnit; | 22 | import java.util.concurrent.TimeUnit; |
24 | import java.util.concurrent.atomic.AtomicLong; | 23 | import java.util.concurrent.atomic.AtomicLong; |
25 | import java.util.stream.Collectors; | 24 | import java.util.stream.Collectors; |
26 | 25 | ||
27 | import static com.google.common.base.Preconditions.checkArgument; | 26 | import static com.google.common.base.Preconditions.checkArgument; |
27 | +import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | ||
28 | +import static org.onlab.util.Tools.groupedThreads; | ||
28 | 29 | ||
29 | /** | 30 | /** |
30 | * Maintains a sliding window of value counts. The sliding window counter is | 31 | * Maintains a sliding window of value counts. The sliding window counter is |
... | @@ -62,7 +63,7 @@ public final class SlidingWindowCounter { | ... | @@ -62,7 +63,7 @@ public final class SlidingWindowCounter { |
62 | .map(AtomicLong::new) | 63 | .map(AtomicLong::new) |
63 | .collect(Collectors.toCollection(ArrayList::new)); | 64 | .collect(Collectors.toCollection(ArrayList::new)); |
64 | 65 | ||
65 | - background = Executors.newSingleThreadScheduledExecutor(); | 66 | + background = newSingleThreadScheduledExecutor(groupedThreads("SlidingWindowCounter", "bg-%d")); |
66 | background.scheduleWithFixedDelay(this::advanceHead, 0, | 67 | background.scheduleWithFixedDelay(this::advanceHead, 0, |
67 | SLIDE_WINDOW_PERIOD_SECONDS, TimeUnit.SECONDS); | 68 | SLIDE_WINDOW_PERIOD_SECONDS, TimeUnit.SECONDS); |
68 | } | 69 | } | ... | ... |
... | @@ -177,7 +177,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { | ... | @@ -177,7 +177,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { |
177 | 177 | ||
178 | private final Accumulator<Event> eventAccummulator = new InternalEventAccummulator(); | 178 | private final Accumulator<Event> eventAccummulator = new InternalEventAccummulator(); |
179 | private final ExecutorService msgSender = | 179 | private final ExecutorService msgSender = |
180 | - newSingleThreadExecutor(groupedThreads("onos/gui", "msg-sender")); | 180 | + newSingleThreadExecutor(groupedThreads("onos/gui", "msg-sender", log)); |
181 | 181 | ||
182 | private TopoOverlayCache overlayCache; | 182 | private TopoOverlayCache overlayCache; |
183 | private TrafficMonitor traffic; | 183 | private TrafficMonitor traffic; | ... | ... |
... | @@ -134,7 +134,7 @@ public final class UiSharedTopologyModel | ... | @@ -134,7 +134,7 @@ public final class UiSharedTopologyModel |
134 | @Activate | 134 | @Activate |
135 | protected void activate() { | 135 | protected void activate() { |
136 | cache = new ModelCache(new DefaultServiceBundle(), eventDispatcher); | 136 | cache = new ModelCache(new DefaultServiceBundle(), eventDispatcher); |
137 | - eventHandler = Executors.newSingleThreadExecutor(Tools.groupedThreads("onos/ui/topo", "event-handler")); | 137 | + eventHandler = Executors.newSingleThreadExecutor(Tools.groupedThreads("onos/ui/topo", "event-handler", log)); |
138 | 138 | ||
139 | eventDispatcher.addSink(UiModelEvent.class, listenerRegistry); | 139 | eventDispatcher.addSink(UiModelEvent.class, listenerRegistry); |
140 | 140 | ... | ... |
-
Please register or login to post a comment