Lars Westergren wrote:
Peter K Chan (JIRA) skrev:My debugging traced the NPE to this method in ThreadService.java, which returns null: public ThreadContext getCurrentContext() { WeakReference wr = (WeakReference) localContext.get();if (wr == null) {wr = adoptCurrentThread(); } else if(wr.get() == null) { wr = adoptCurrentThread(); } return (ThreadContext)wr.get(); // Can still return null. Bug? }Isn't this just bad luck with the concurrency? In the if statement, wr.get() does return an object. Then the GC kicks in, and when you reach the return statement, wr.get() is null. Or am I missing something?
Probably, yes. We should get it once and only once, otherwise it's not an atomic operation.
- Charlie --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
