[concurrency-interest] Final field set null on thread termination

sandeep bansal sandeep.bansal85 at gmail.com
Mon Oct 4 02:13:47 EDT 2010


Hi Everyone,

Setting the
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
solved the problem for me in tomcat 6. Thanks again Tim.

On Thu, Sep 30, 2010 at 7:28 PM, sandeep bansal
<sandeep.bansal85 at gmail.com>wrote:

> Hi Everyone,
>
> I have a thread which is something like this:
>
> public class LogThread extends Thread {
>         ...
>     private static volatile boolean stopped;
>     private final StatisticsLogger statsLogger;
>     ...
>     public LogThread(String loggerName, Config config) {
>         statsLogger = new FileLogger(loggerName, config);
>     }
>
>     public void run() {
>         if (statsLogger == null) {
>             return;
>         }
>         while(!LogThread.stopped) {
>             try {
>                             ...
>                             statsLogger.log(logData);
>                             ...
>             } catch (Exception ex) {
>                 logger.error("Exception when logging data", ex);
>             }
>         }
>         statsLogger.shutdown();
>     }
>
>     public static final void shutdown() {
>         stopped = true;
>     }
> }
>
> http://pastie.org/1191267
>
> The problem is that whenever i shutdown the thread statsLogger.shutdown()
> throws a null pointer exception. I have no idea why this is happening. My
> java version is 1.6.0.18. Can anyone please give me a clue.
>
> --
> Regards,
> Sandeep
>



-- 
With warm regards,
Sandeep
9868615579
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20101004/ca7a5771/attachment.html>


More information about the Concurrency-interest mailing list