You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Tjorven Lauchardt <tl...@newbase.de> on 2004/02/06 00:15:22 UTC

invokeAndWait problem

Hi,

I have a question about the invokeAndWair() method of RunnableQueue. 
This code:
getCanvas().getUpdateManager().getUpdateRunnableQueue().invokeAndWait(new 
NoRepaintRunnable() {
	public void run() {...}
});
crashes every time into an IllegalStateException "Cannot be called from 
the RunnableQueue thread". Where do I have to search? Is the call of 
invokeAndWait itself wrong or where else could hide the error?

Thank you and regards,

Tjorven


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


Re: Updates by a specific Runnable

Posted by Thomas DeWeese <Th...@Kodak.com>.
Tjorven Lauchardt wrote:

> is there a possibiblity to get that time, when all updates of a certain 
> Runnable, that has been given to the runnablequeue of the updatemanager, 
> has been made? I want to invoke a function right then, because I need 
> the canvas rendering transform at that moment.

   For something simple like this you can probably just make a call
at the end of the runnable in question (make sure the method
you call is thread safe!).

   The RunnableQueue implementation does not have full
fledged event handling.  There is a notion of a RunHandler that
get's call backs but right now there is only one and it is
an inner class of the UpdateManager.

> Kind regards, tjorven
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
> 



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


Updates by a specific Runnable

Posted by Tjorven Lauchardt <tl...@newbase.de>.
Hi,

is there a possibiblity to get that time, when all updates of a certain 
Runnable, that has been given to the runnablequeue of the updatemanager, 
has been made? I want to invoke a function right then, because I need 
the canvas rendering transform at that moment.

Kind regards, tjorven


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


Re: invokeAndWait problem

Posted by Thomas DeWeese <Th...@Kodak.com>.
Tjorven Lauchardt wrote:

> Hi,
> 
> I have a question about the invokeAndWair() method of RunnableQueue. 
> This code:
> getCanvas().getUpdateManager().getUpdateRunnableQueue().invokeAndWait(new 
> NoRepaintRunnable() {
>     public void run() {...}
> });
> crashes every time into an IllegalStateException "Cannot be called from 
> the RunnableQueue thread". Where do I have to search? Is the call of 
> invokeAndWait itself wrong or where else could hide the error?

    If you are already in the Update Manager's runnable queue
you don't have to/can't call invokeAndWait, but you can just
run your code.  You can check if you are already in the Update
Manager thread with:

    Runnable r = new NoRepaintRunnable() {
          ....
    }

    if (um.getUpdateRunnableQueue().getThread()==Thread.currentThread)
       r.run();
    else
       ...invokeLater(r);




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