dev@grizzly.java.net

Re: Issue No. 534

From: Minoru Nitta <minoru.nitta_at_jp.fujitsu.com>
Date: Fri, 15 May 2009 15:34:08 +0900

Salut,


> Salut,
>
>
> > >> Yesterday I added a configuration API to avoid caching Context. I
> > >> did some benchmark and didn't see any regressions but a very tiny
> > >> improvement...but I need to do more testing as I suspect it will
> > >> impact garbage collection a lot. So I will implement the Context-
> > >> per-thread tomorrow and do more testing.
> > > Not sure this will be easy. As we create Context and *then* pass it
> > > to thread pool, which in its turn picks up a thread and runs task.
> > > So, to be able to use Context-per-Thread we need to be able to pick
> > > up a thread from thread pool, get associated Context and then run
> > > the task directly on thread, bypassing thread pool.
> > I will correct myself.
> > For Leader/Follower strategy, which we recently implemented, we can
> > use Context-per-Thread. I've implemented that for 1.9.16
>
>
> That's great! Thank you for your implementation. I'll test my
> program on 1.9.16.


I have tested my program with grizzly revision 3193, but the same
NullPointerException occurred.

java.lang.NullPointerException
        at com.sun.grizzly.SelectionKeyContextTask.afterCall(SelectionKeyContextTask.java:80)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:60)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)


I tested
 - Controller.useLeaderFollowerStrategy = true (default)
 - Controller.setAllowContextCaching = both false and true
 

How can I avoid NullPointerException?

Thanks.

Minoru

>
> Minoru
>
>