package org.http4s.client

import java.io.IOException
import java.net.InetSocketAddress
import java.util.concurrent.TimeUnit
import java.util.concurrent._

import org.http4s.blaze.util.TickWheelExecutor

import scala.concurrent.duration._

import scalaz.\/


package object blaze {

  type AddressResult = \/[IOException, InetSocketAddress]

  // Centralize some defaults
  private[blaze] val DefaultTimeout: Duration = 60.seconds
  private[blaze] val DefaultBufferSize: Int = 8*1024
  private[blaze] val ClientDefaultEC = {
    val threadFactory = new ThreadFactory {
      val defaultThreadFactory = Executors.defaultThreadFactory()
      def newThread(r: Runnable): Thread = {
        val t = defaultThreadFactory.newThread(r)
        t.setDaemon(true)
        t
      }
    }

    new ThreadPoolExecutor(
      2,
      Runtime.getRuntime.availableProcessors() * 6,
      60L, TimeUnit.SECONDS,
      new LinkedBlockingQueue[Runnable](),
      threadFactory
    )
  }

  private[blaze] val ClientTickWheel = new TickWheelExecutor()

  /** Default blaze client */
  val defaultClient = SimpleHttp1Client(DefaultTimeout, DefaultBufferSize, ClientDefaultEC, None)
}

package org.http4s.client

import java.io.IOException
import java.net.InetSocketAddress

import org.http4s.blaze.util.TickWheelExecutor

import scala.concurrent.duration._

import scalaz.\/
import scalaz.concurrent.Strategy.DefaultExecutorService


package object blaze {

  type AddressResult = \/[IOException, InetSocketAddress]

  // Centralize some defaults
  private[blaze] val DefaultTimeout: Duration = 60.seconds
  private[blaze] val DefaultBufferSize: Int = 8*1024
  private[blaze] def ClientDefaultEC = DefaultExecutorService
  private[blaze] val ClientTickWheel = new TickWheelExecutor()

  /** Default blaze client */
  val defaultClient = SimpleHttp1Client(DefaultTimeout, DefaultBufferSize, ClientDefaultEC, None)
}

--- 
+++ 
@@ -2,13 +2,14 @@
 
 import java.io.IOException
 import java.net.InetSocketAddress
+import java.util.concurrent.TimeUnit
+import java.util.concurrent._
 
 import org.http4s.blaze.util.TickWheelExecutor
 
 import scala.concurrent.duration._
 
 import scalaz.\/
-import scalaz.concurrent.Strategy.DefaultExecutorService
 
 
 package object blaze {
@@ -18,7 +19,25 @@
   // Centralize some defaults
   private[blaze] val DefaultTimeout: Duration = 60.seconds
   private[blaze] val DefaultBufferSize: Int = 8*1024
-  private[blaze] def ClientDefaultEC = DefaultExecutorService
+  private[blaze] val ClientDefaultEC = {
+    val threadFactory = new ThreadFactory {
+      val defaultThreadFactory = Executors.defaultThreadFactory()
+      def newThread(r: Runnable): Thread = {
+        val t = defaultThreadFactory.newThread(r)
+        t.setDaemon(true)
+        t
+      }
+    }
+
+    new ThreadPoolExecutor(
+      2,
+      Runtime.getRuntime.availableProcessors() * 6,
+      60L, TimeUnit.SECONDS,
+      new LinkedBlockingQueue[Runnable](),
+      threadFactory
+    )
+  }
+
   private[blaze] val ClientTickWheel = new TickWheelExecutor()
 
   /** Default blaze client */
Change default blaze client Executor to a variable sized ExecutorService.
