geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevan Miller <kevan.mil...@gmail.com>
Subject Re: Timer already canceled
Date Thu, 01 Mar 2007 02:46:26 GMT

On Feb 28, 2007, at 6:50 PM, Jay D. McHugh wrote:

> Joel,
>
>
> Another thing you might check is your heap size (if you are using a  
> geronimo version below 2.0).  Since I started working with 2.0, I  
> have been able to set a rather low minimum heap.  When I was  
> working with 1.x versions (and Java 1.4) I needed to increase my  
> heap size or I would get 'timer already cancelled' errors.  There  
> was a JIRA created for this to make the error message reflect what  
> had actually happened but I don't know if it got fixed (just  
> checked it and it's still open).
>
> Try setting a higher maximum heap size for Java and try again -  
> maybe that will be all you need.

Jay,
Excellent point. Something about this problem was bothering me, but I  
just couldn't remember what... Time to do something about this class  
of error, I guess. Although it's hard to make it foolproof.

Even with the Jira (https://issues.apache.org/jira/browse/ 
GERONIMO-2114), I had a hard time remembering how this error could  
occur...

So, let me try again...

java.util.Timer creates a Thread which is used to dispatch Task  
execution. If an Error or RuntimeException occurs on this Thread, the  
Timer will be marked as "cancelled". Any further attempts to use this  
Timer will result in a Timer already cancelled IllegalStateException.

We can do the following:

1) catch Throwable in TimerTask.run() and log errors. Note that  
errors could still occur in the Timer Thread which we cannot catch...
2) catch IllegalStateExceptions thrown by Timer.schedule() and throw  
an exception explaining that an OOME might have caused the error.

--kevan

Mime
View raw message