incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/2] git commit: Fixing some annoyance with naming a thread for logging and debugging.
Date Sun, 19 May 2013 21:31:07 GMT
Updated Branches:
  refs/heads/0.1.5 791d73358 -> 7e31cd283


Fixing some annoyance with naming a thread for logging and debugging.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/5fd0a0f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/5fd0a0f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/5fd0a0f2

Branch: refs/heads/0.1.5
Commit: 5fd0a0f2984fe906afcd961715fff96dc81d3648
Parents: 791d733
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun May 19 07:01:19 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun May 19 07:01:19 2013 -0400

----------------------------------------------------------------------
 .../thrift/server/TThreadedSelectorServer.java     |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/5fd0a0f2/src/blur-thrift/src/main/java/org/apache/blur/thrift/server/TThreadedSelectorServer.java
----------------------------------------------------------------------
diff --git a/src/blur-thrift/src/main/java/org/apache/blur/thrift/server/TThreadedSelectorServer.java
b/src/blur-thrift/src/main/java/org/apache/blur/thrift/server/TThreadedSelectorServer.java
index 8936b74..36c6e37 100644
--- a/src/blur-thrift/src/main/java/org/apache/blur/thrift/server/TThreadedSelectorServer.java
+++ b/src/blur-thrift/src/main/java/org/apache/blur/thrift/server/TThreadedSelectorServer.java
@@ -60,6 +60,8 @@ import org.slf4j.LoggerFactory;
 public class TThreadedSelectorServer extends AbstractNonblockingServer {
   private static final Logger LOGGER = LoggerFactory.getLogger(TThreadedSelectorServer.class.getName());
 
+  private static int selectorThreadCount;
+
   public static class Args extends AbstractNonblockingServerArgs<Args> {
 
     /** The number of threads for selecting on already-accepted connections */
@@ -220,7 +222,7 @@ public class TThreadedSelectorServer extends AbstractNonblockingServer
{
         selectorThreads.add(new SelectorThread(args.acceptQueueSizePerThread));
       }
       acceptThread = new AcceptThread((TNonblockingServerTransport) serverTransport_,
-        createSelectorThreadLoadBalancer(selectorThreads));
+          createSelectorThreadLoadBalancer(selectorThreads));
       for (SelectorThread thread : selectorThreads) {
         thread.start();
       }
@@ -356,8 +358,8 @@ public class TThreadedSelectorServer extends AbstractNonblockingServer
{
      * 
      * @throws IOException
      */
-    public AcceptThread(TNonblockingServerTransport serverTransport,
-        SelectorThreadLoadBalancer threadChooser) throws IOException {
+    public AcceptThread(TNonblockingServerTransport serverTransport, SelectorThreadLoadBalancer
threadChooser)
+        throws IOException {
       this.serverTransport = serverTransport;
       this.threadChooser = threadChooser;
       this.acceptSelector = SelectorProvider.provider().openSelector();
@@ -536,6 +538,10 @@ public class TThreadedSelectorServer extends AbstractNonblockingServer
{
      */
     public void run() {
       try {
+        Thread thread = Thread.currentThread();
+        if (thread.getName().startsWith("Thread-")) {
+          thread.setName("TThreadedSelectorServer-SelectorThread-" + selectorThreadCount++);
+        }
         while (!stopped_) {
           select();
           processAcceptedConnections();


Mime
View raw message