Merge pull request #503 from y-higuchi/thread_name
Give each Thread a name
diff --git a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
index d777202..22241ce 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
@@ -82,6 +82,8 @@
protected class SwitchCleanup implements ControlChangeCallback, Runnable {
@Override
public void run() {
+ String old = Thread.currentThread().getName();
+ Thread.currentThread().setName("SwitchCleanup@" + old);
try {
log.debug("Running cleanup thread");
switchCleanup();
@@ -92,6 +94,7 @@
op.close();
cleanupTask.reschedule(CLEANUP_TASK_INTERVAL,
TimeUnit.SECONDS);
+ Thread.currentThread().setName(old);
}
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
index b25634f..afadaa4 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
@@ -148,6 +148,7 @@
*/
@Override
public void run() {
+ this.setName("FlowEventHandler " + this.getId());
startup();
//
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
index cc92ccd..e821a97 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -612,6 +612,7 @@
// The main loop
//
Collection<FlowPath> collection = new LinkedList<FlowPath>();
+ this.setName("FlowDatabaseWriter " + this.getId() );
try {
while (true) {
FlowPath flowPath = blockingQueue.take();
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java
index 6485c5e..4529382 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java
@@ -152,6 +152,7 @@
@Override
public void run() {
+ this.setName("FlowPusherThread " + this.getId() );
while (true) {
try {
// wait for message pushed to queue