Skip to content

Commit

Permalink
Add releaseExternalResources calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Haberman committed Jun 15, 2010
1 parent 2267ff9 commit dacf0e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/scala/fakehttp/Proxy.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import fakehttp.ssl._

class Proxy(val interceptor: Interceptor, val port: Int, val sslMode: SslMode) {
val pool = Executors.newCachedThreadPool

// The IncomingRequestHandler will create outgoing traffic, so pass along the outgoingChannelFactory
val outgoingChannelFactory = new NioClientSocketChannelFactory(pool, pool)
val incomingPipelineFactory = new IncomingPipelineFactory(interceptor, sslMode, outgoingChannelFactory)
Expand All @@ -26,6 +26,8 @@ class Proxy(val interceptor: Interceptor, val port: Int, val sslMode: SslMode) {
incomingPipelineFactory.closeRequestHandlers
pool.shutdown
pool.awaitTermination(1, TimeUnit.MINUTES)
incomingBootstrap.releaseExternalResources
outgoingChannelFactory.releaseExternalResources
}
}

Expand Down

0 comments on commit dacf0e9

Please sign in to comment.