From: Martin Thompson <mjpt...@gmail.com>
Date: Tue, 19 Jul 2011 00:05:58 -0700 (PDT)
Local: Tues, Jul 19 2011 3:05 am
Subject: Re: How to properly shutdown disruptor?
I've tried to keep the API similar to other threading frameworks. You
are right about the steps above. I like the idea that halt() just stops the consumer once it has finished the current cycle in a very similar way to Thread.interrupt() works. I often have a method that checks if a backlog of items is still being processed then call halt. Remember that if you interrupt a thread you still have to wait on it finishing by calling join() or similar. 1.
2.
}
3.
for (Consumer consumer: consumers) { consumer.halt(); }
<can restart threads at this point if we want>
4.
/**
for (Consumer consumer : consumers)
return false;
}
On Jul 18, 11:59 pm, Olivier Deheurles <m...@odeheurles.com> wrote:
> Hi Curtis,
> Calling halt on a consumer will finish processing current entry (or current entries if you're in the middle of a batch). This call is asynchronous (ie. the call can return before the consumer is properly stoped).
> If you want to stop the consumer(s) when all pending entries have been processed:
> If you use Adrian's DisruptorWizard DSL you will see there is a halt method on the DisruptorWizard (but this does not guarantee all pending entries have been processed).
> @LMAX guys: should the halt method on the wizard and on the batch consumer take the sequence number after which you release the consumer thread?
> Olivier
> Le 18 juil. 2011 à 22:34, Curtis Stanford <cur...@stanfordcomputing.com> a écrit :
> > Hi, just wondering what's the proper way to shutdown a disruptor ring and the executor service behind it? I tried calling executor.shutdown but it times out. Calling halt on the consumers doesn't finish what's currently in the ring. My application won't exit with the executor service running. Is there some way to finish what's in the ring but shutdown the threads, etc. afterwards?
> > Thanks
> > Curtis You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||