On Thu, Mar 12, 2009 at 10:45 AM, Oscar <[email protected]> wrote:
> hi all-
> To simplify the business-side code, I wanna run the messageReceived in the
> main thread.
>
> I know I could put all the received object to the  unique queue, and then
> the main thread fetch and handle the message in the queue.
>
> Any better way?
If this sort of mechanism is what you absolutely want, then I suggest
having the messageReceived event post the work-item to an Executor (in
your case, an instance created by
Executors.newSingleThreadExecutor()).

That way all work is done in a single thread.

If you want things run in the main thread... then you're "stuck" with
starting the Mina queue and using a BlockingQueue implementation.

-- 
Thomas Harning Jr.

Reply via email to