You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Maik Schürer <Ma...@proveo.de> on 2005/06/08 12:28:58 UTC

RunnableQueue InterruptedException

Hi all,
when running my application awhile, sometime in RunnableQueue run() 
method an InterruptedException appears.
Then there the runnableQueueThread is set to null:
...
   } catch (InterruptedException e) {
   } finally {
      synchronized (this) {
         runnableQueueThread = null;
      }
   }
...
that means, from there I can't call RunnableQueue.invokeLater()
(because then it throws an IllegalStateException)

1) What could be a reason, that the InterruptedException appears ?
2) How can I "restart" the RunnableQueue to get the runnableQueueThread 
again ?

Thanks in advance
Maik


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: RunnableQueue InterruptedException

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Maik,

    This is a sure sign that you are modifying the
DOM tree outside of the UpdateManager's RunnableQueue.
This can only happen if the GVT tree is modified while
a repaint is happening, as you can see the repaint is
in the RunnableQueue so the DOM modification must be in
some other thread...

Maik Schürer wrote:
> I tried the patch...
> now - after while - at
> RunnableQueue.run()  line 140
>     while (!HaltingThread.hasBeenHalted()) {
> 
> appears
> 
> java.util.ConcurrentModificationException
> at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782)
> at java.util.HashMap$KeyIterator.next(HashMap.java:818)
> at org.apache.batik.gvt.UpdateTracker.getDirtyAreas(UpdateTracker.java:69)
> at 
> org.apache.batik.bridge.UpdateManager.repaint(UpdateManager.java:452)472089
> at 
> org.apache.batik.bridge.UpdateManager$UpdateManagerRunHander.runnableInvoked(UpdateManager.java:590) 
> 
> at 
> org.apache.batik.util.RunnableQueue.runnableInvoked(RunnableQueue.java:489)
> at org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:209)
> at java.lang.Thread.run(Thread.java:534)
> 
> 
> Thomas DeWeese schrieb:
> 
>> Hi Maik,
>>
>>
>>
>> Maik Schürer wrote:
>>
>>> when running my application awhile, sometime in RunnableQueue run() 
>>> method an InterruptedException appears.
>>
>>
>>
>>    I've never seen this myself, but looking at the code I
>> patched a small hole that could cause this.  Please get
>> the CVS version of Batik and see if this solves the problem
>> for you.  Just out of curiosity are you seeing this when
>> using the RunnableQueue from the UpdateManager or are you
>> using it as a general 'job queue'?
>>
>>    Someone would have to be interrupting the thread quite
>> frequently for this bug to appear and currently I don't think
>> Batik uses Thread.interrupt at all due to issues with the class
>> loader in many versions of the JDK.
>>
>>> that means, from there I can't call RunnableQueue.invokeLater()
>>> (because then it throws an IllegalStateException)
>>>
>>> 1) What could be a reason, that the InterruptedException appears ?
>>
>>
>>    Most likely the bug I fixed but something stranger might be
>> happening.
>>
>>> 2) How can I "restart" the RunnableQueue to get the 
>>> runnableQueueThread again ?
>>
>>
>>
>>    This isn't trivial and probably isn't a good idea but you
>> can associate the RunnableQueue instance with a new HaltingThread
>> instance and start the halting thread.  This probably wouldn't work
>> for the RunnableQueue embedded in the UpdateManager because the
>> UpdateManager wouldn't know about the new thread.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: RunnableQueue InterruptedException

Posted by Maik Schürer <Ma...@proveo.de>.
I tried the patch...
now - after while - at
RunnableQueue.run()  line 140
	while (!HaltingThread.hasBeenHalted()) {

appears

java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782)
at java.util.HashMap$KeyIterator.next(HashMap.java:818)
at org.apache.batik.gvt.UpdateTracker.getDirtyAreas(UpdateTracker.java:69)
at 
org.apache.batik.bridge.UpdateManager.repaint(UpdateManager.java:452)472089
at 
org.apache.batik.bridge.UpdateManager$UpdateManagerRunHander.runnableInvoked(UpdateManager.java:590)
at 
org.apache.batik.util.RunnableQueue.runnableInvoked(RunnableQueue.java:489)
at org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:209)
at java.lang.Thread.run(Thread.java:534)


Thomas DeWeese schrieb:
> Hi Maik,
> 
> 
> 
> Maik Schürer wrote:
> 
>> when running my application awhile, sometime in RunnableQueue run() 
>> method an InterruptedException appears.
> 
> 
>    I've never seen this myself, but looking at the code I
> patched a small hole that could cause this.  Please get
> the CVS version of Batik and see if this solves the problem
> for you.  Just out of curiosity are you seeing this when
> using the RunnableQueue from the UpdateManager or are you
> using it as a general 'job queue'?
> 
>    Someone would have to be interrupting the thread quite
> frequently for this bug to appear and currently I don't think
> Batik uses Thread.interrupt at all due to issues with the class
> loader in many versions of the JDK.
> 
>> that means, from there I can't call RunnableQueue.invokeLater()
>> (because then it throws an IllegalStateException)
>>
>> 1) What could be a reason, that the InterruptedException appears ?
> 
>    Most likely the bug I fixed but something stranger might be
> happening.
> 
>> 2) How can I "restart" the RunnableQueue to get the 
>> runnableQueueThread again ?
> 
> 
>    This isn't trivial and probably isn't a good idea but you
> can associate the RunnableQueue instance with a new HaltingThread
> instance and start the halting thread.  This probably wouldn't work
> for the RunnableQueue embedded in the UpdateManager because the
> UpdateManager wouldn't know about the new thread.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: RunnableQueue InterruptedException

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Maik,



Maik Schürer wrote:
> when running my application awhile, sometime in RunnableQueue run() 
> method an InterruptedException appears.

    I've never seen this myself, but looking at the code I
patched a small hole that could cause this.  Please get
the CVS version of Batik and see if this solves the problem
for you.  Just out of curiosity are you seeing this when
using the RunnableQueue from the UpdateManager or are you
using it as a general 'job queue'?

    Someone would have to be interrupting the thread quite
frequently for this bug to appear and currently I don't think
Batik uses Thread.interrupt at all due to issues with the class
loader in many versions of the JDK.

> that means, from there I can't call RunnableQueue.invokeLater()
> (because then it throws an IllegalStateException)
> 
> 1) What could be a reason, that the InterruptedException appears ?
    Most likely the bug I fixed but something stranger might be
happening.

> 2) How can I "restart" the RunnableQueue to get the runnableQueueThread 
> again ?

    This isn't trivial and probably isn't a good idea but you
can associate the RunnableQueue instance with a new HaltingThread
instance and start the halting thread.  This probably wouldn't work
for the RunnableQueue embedded in the UpdateManager because the
UpdateManager wouldn't know about the new thread.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org