package com.twitter.finagle


import com.twitter.concurrent.NamedPoolThreadFactory
import java.util.concurrent.Executors
import org.jboss.netty.util.{ThreadNameDeterminer, ThreadRenamingRunnable}

/**
 * Package netty3 implements the bottom finagle primitives:
 * {{com.twitter.finagle.Server}} and a client transport in terms of
 * the netty3 event loop.
 *
 * Note: when {{com.twitter.finagle.builder.ClientBuilder}} and
 * {{com.twitter.finagle.builder.ServerBuilder}} are deprecated,
 * package netty3 can move into its own package, so that only the
 * (new-style) clients and servers that depend on netty3 bring it in.
 */
package object netty3 {
  // Disable Netty's thread name rewriting, to preserve the "finagle/netty3"
  // suffix specified below.
  ThreadRenamingRunnable.setThreadNameDeterminer(ThreadNameDeterminer.CURRENT);

  val Executor = Executors.newCachedThreadPool(
    new NamedPoolThreadFactory("finagle/netty3", true/*daemon*/))

  object param {
    /**
     * A class eligible for configuring a netty3 timer.
     */
    case class Netty3Timer(timer: org.jboss.netty.util.Timer)
    implicit object Netty3Timer extends Stack.Param[Netty3Timer] {
      val default = Netty3Timer(util.DefaultTimer)
    }
  }
}

package com.twitter.finagle

import java.util.concurrent.Executors
import com.twitter.concurrent.NamedPoolThreadFactory

/**
 * Package netty3 implements the bottom finagle primitives:
 * {{com.twitter.finagle.Server}} and a client transport in terms of
 * the netty3 event loop.
 *
 * Note: when {{com.twitter.finagle.builder.ClientBuilder}} and
 * {{com.twitter.finagle.builder.ServerBuilder}} are deprecated,
 * package netty3 can move into its own package, so that only the
 * (new-style) clients and servers that depend on netty3 bring it in.
 */
package object netty3 {
  val Executor = Executors.newCachedThreadPool(
    new NamedPoolThreadFactory("finagle/netty3", true/*daemon*/))

  object param {
    /**
     * A class eligible for configuring a netty3 timer.
     */
    case class Netty3Timer(timer: org.jboss.netty.util.Timer)
    implicit object Netty3Timer extends Stack.Param[Netty3Timer] {
      val default = Netty3Timer(util.DefaultTimer)
    }
  }
}

--- 
+++ 
@@ -1,7 +1,9 @@
 package com.twitter.finagle
 
+
+import com.twitter.concurrent.NamedPoolThreadFactory
 import java.util.concurrent.Executors
-import com.twitter.concurrent.NamedPoolThreadFactory
+import org.jboss.netty.util.{ThreadNameDeterminer, ThreadRenamingRunnable}
 
 /**
  * Package netty3 implements the bottom finagle primitives:
@@ -14,6 +16,10 @@
  * (new-style) clients and servers that depend on netty3 bring it in.
  */
 package object netty3 {
+  // Disable Netty's thread name rewriting, to preserve the "finagle/netty3"
+  // suffix specified below.
+  ThreadRenamingRunnable.setThreadNameDeterminer(ThreadNameDeterminer.CURRENT);
+
   val Executor = Executors.newCachedThreadPool(
     new NamedPoolThreadFactory("finagle/netty3", true/*daemon*/))
 
[split] finagle: Disable Netty's thread name renaming

Problem

Netty is rewriting the name of the threads in the thread-pool with "New I/O worker #*".
This makes things difficult for new Finagle users to identify those threads as Finagle ones.

Solution

Disable Netty's thread renaming.

RB_ID=412147
