That would work, but it adds more polling. I can do that now in Java by sending 
an interrupt to a polling thread. But the solution I am looking for (well one 
of them) would be to be able to block the thread on subscriber read and yet be 
able to interrupt that particular thread in Java. I am not seeing a way of 
doing that.
It seems that my thread-per-user approach is not something that others are 
doing. I imagine they are using polling instead.

Mike.

On Feb 16, 2011, at 6:28 AM, Ian Barber wrote:

> On Tue, Feb 15, 2011 at 9:14 PM, Michael Kogan <[email protected]> 
> wrote:
> I have a question regarding a pub/sub messaging bus and how 0mq integrates 
> with Java threads.
> I have a thread for each sub socket with a poller (using the ZMQForwarder as 
> a template), and it seems that I may be wasting resources. I would much 
> prefer those threads to just wait on data, however, unless native java 
> synchronized access , the .recv() method cannot be interrupted by a 
> controller, so I am not sure how that thread would be cleaned up hmm cleanly 
> without using polling to periodically check if it needs to exit.
> Any thoughts or suggestion from the experts? 
> 
> I would imagine that you could do something like add another zeromq socket 
> for control messages, and poll for them both - then have a separate thread 
> that will catch the interruption and send a shutdown type message (or 
> whatever you want it to do) to your subs. 
> 
> Ian
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to