>
> > Problem is I cannot call resume() because the grizzly
> > workerthread (protocolParser) might still be using the same context.
>
> I see. But why are you resuming? Is it because you need more read
> operations?
>
Well I am only resuming because I want to be nice and give grizzly the used
context back for its context pool.
Before the suspend method I just got handles to the things I needed from
context for the new businesslogic Thread. Like selection key and asyncWriter... But since I am
writing a tutorial I thought readers are used to the Context concept and so I should stick to it
and not create a new holder Object.
I am doing something like this:
private void dispatch(final Message msg, final Context workerCtx) {
workerCtx.suspend();
workerCtx.setKeyRegistrationState(Context.KeyRegistrationState.REGISTER);
executorService.execute(new Runnable() {
public void run() {
doBusinessLogic(msg,workerCtx)
workerCtx.resume();
}
});
}
Well maybe I should really just copy the things I need from the context and
give it to the businessLogic Thread like
doBusinessLogic(msg,workerCtx.getSelectionKey(),workerCtx.getAsyn,workCtx.getSelectorHandler())
Many Greetings
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser