[vtkusers] multithreading java applications

Sebastien Jourdain sebastien.jourdain at kitware.com
Fri Nov 5 12:19:30 EDT 2010


Hi Jonathan,

You are going in the right direction, but for your other questions, I
don't have any ideas as I never used the classes that you mentioned.
But some time ago, I've used VTK in Java with an extensive use of
multi-threading and it worked pretty well if you know what you are
doing... Basically, the idea is to call Update() at the end of a
pipeline that is not involved in any other thread that might work with
that pipeline...

Good luck with your project,

Seb

On Fri, Nov 5, 2010 at 12:06 PM, Jonathan Morra <jonmorra at gmail.com> wrote:
> That makes a lot of sense about why this is so frustrating.  Thanks to your
> advice, I am able to make use of invokeLater to at least display dialogs to
> the user and then run processes on the event dispatch thread.  In addition
> I'm trying to work with SwingWorker's doInBackground and done methods to
> move VTK operations that are not yet attached to the UI into a different
> thread, and then attach them to the UI in the done() method.
> Thanks again for your help
> PS, I have two outstanding questions that I really would like some help with
> http://permalink.gmane.org/gmane.comp.lib.vtk.user/52639
> and
> http://comments.gmane.org/gmane.comp.lib.vtk.user/52679
>
> On Wed, Nov 3, 2010 at 12:05 PM, Sebastien Jourdain
> <sebastien.jourdain at kitware.com> wrote:
>>
>> Hi Jonathan,
>>
>> VTK is not thread safe at all. So you first should be aware of that.
>> Then any Swing call should be made in the EDT (event dispatch thread.
>> SwingUtilities.invokeLater..)
>> To get a more precise answer, you will need to be more precise in your
>> multi-threaded case...
>> Once the VTK objects are connected to the renderer, they should only
>> be updated through the EDT.
>>
>> Seb
>>
>> On Wed, Nov 3, 2010 at 1:32 PM, Jonathan Morra <jonmorra at gmail.com> wrote:
>> > I have an application that works fine in Java when the whole application
>> > is
>> > in one thread.  However, when I multi-thread the application
>> > I intermittently get the following error
>> > ERROR: In ..\..\src\Rendering\vtkWin32OpenGLRenderWindow.cxx, line 247
>> > vtkWin32OpenGLRenderWindow (000000005AE922B0): wglMakeCurrent failed in
>> > MakeCurrent(), error: The requested resource is in use.
>> > I don't know what is going on, but it only happens when I use Java
>> > threads.
>> > Does anyone know what's going on and how to fix it?
>> > Thanks
>> > _______________________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the VTK FAQ at:
>> > http://www.vtk.org/Wiki/VTK_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.vtk.org/mailman/listinfo/vtkusers
>> >
>> >
>
>



More information about the vtkusers mailing list