Re: [dispatch-scala] Http.shutdown() Needs to Be Called Explicitly?

236 views
Skip to first unread message

Nathan Hamblen

unread,
Jan 26, 2015, 7:49:43 AM1/26/15
to Ji ZHANG, dispatc...@googlegroups.com

Simplest thing for the example you have would be to use a lazy val.

On Jan 26, 2015 2:30 AM, Ji ZHANG <zhan...@gmail.com> wrote:
Hi,

I'm using dispatch 0.11.2, and it seems that the packaged jar just won't quit. I googled a lot and did some experiments, found out that Http.shutdown() must be called explicitly.

I checked out the source code, and sees Http is an object that'll automatically initiate with a new http-async-client. So even if I use 'val http = new Http();...;http.shutdown()', the Http still needs to be shutdown.

Is it designed so? If I want to use dispatch in a library, does it mean I need to let the library user shutdown Http explicitly?

I found out that in sbt everything works fine, but I don't understand how SbtProcessDefaults works. I tried sys.addShutdownHook(() => Http.shutdown()), with no luck.

So I'm wondering whether there's a simple way to to implicitly shutdown Http, or not start it at all. Besides, the new documentation mentions nothing about shutdown...

Thanks.

--
You received this message because you are subscribed to the Google Groups "Dispatch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dispatch-scal...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ji ZHANG

unread,
Jan 27, 2015, 12:52:24 AM1/27/15
to dispatc...@googlegroups.com, zhan...@gmail.com
Hi Nathan,

Sorry I don't quite understand. the Http is an object defined in the following file:


And I kinda hope it is not initialized at all so I don't need to shutdown it explicitly.

What do you mean lazy val?

Thanks.
Reply all
Reply to author
Forward
0 new messages