2

How can I replace default thread pool in Dispatch ? I see here https://github.com/dispatch/dispatch/blob/master/futures/src/main/scala/Futures.scala that instantiates CachedThreadPool. I'd like to use FixedThreadPool instead.

expert
  • 29,290
  • 30
  • 110
  • 214

1 Answers1

1

Well, sorry for being lazy, guys. Quick look at sources of Dispatch showed that I can pass my thread executor via setExecutorService of Http.configure.

For example

val pool: ExecutorService = Executors.newFixedThreadPool(4)
val httpClient: Http = Http.configure(_.setAllowPoolingConnection(true).setFollowRedirects(true).setConnectionTimeoutInMs(1000).setExecutorService(pool))
expert
  • 29,290
  • 30
  • 110
  • 214
  • 1
    The only problem is that it didn't work. Dispatch doesn't use object that I passed :( I'll post updates later. – expert Apr 12 '13 at 19:02