[zeromq-dev] ZMQ Java - Best practice to clean when exiting

2014-11-18 Thread rails
In ZMQ zguide they advice http://zguide.zeromq.org/page:all#Making-a-Clean-Exit to always clean up when task ends. I am a bit confused regarding the best practice. First ... even if you close all sockets, zmq_ctx_destroy() will by default wait forever... Finally, destroy the context... This will

Re: [zeromq-dev] ZMQ Java - Best practice to clean when exiting

2014-11-18 Thread Pieter Hintjens
1. set linger = 0 on all sockets 2. close all sockets 3. terminate context On Tue, Nov 18, 2014 at 9:10 AM, rails stammail...@gmail.com wrote: In ZMQ zguide they advice to always clean up when task ends. I am a bit confused regarding the best practice. First ... even if you close all

Re: [zeromq-dev] ZMQ Java - Best practice to clean when exiting

2014-11-18 Thread rails
Thanks. But if I look at the jeromq code - I see inside ZContext.destroy a call for destroySocket (to each socket ) which s.setLinger(linger); s.close(); sockets.remove(s); And then It even calls sockets.clear(); and context.term(); So - Am i safe by calling the java (jeroMQ ) implementation of

Re: [zeromq-dev] ZMQ Java - Best practice to clean when exiting

2014-11-18 Thread Min
context.destroy might be ok if you only work with jeromq. But still the best practice is calling close and term explicitly at the end of your logic for future reference and same style on other platforms. Thanks Min On Nov 18, 2014, at 1:26 AM, rails stammail...@gmail.com wrote: Thanks.