Re: Image capture -- renegade threads

Hi Leah,

Its possible that DisplayImpl.destroy() misses some Threads,
although with 7 some must be coming from somewhere else.

You might try running under jdb, then after the destroy()
use the 'suspend all' command followed by 'where all',
which should list all the Threads. If you do this, please
send us the output of 'where all'.

Another thought: if you want to capture a series of
iamges, can you call DisplsayImpl.removeAllReferences()
and/or DisplayImpl.clearMaps() between images, then re-use
the DisplayImpl?

Cheers,
Bill

On Fri, 15 Aug 2003, Leah Heiss wrote:

> I've tried calling destroy() on my DisplayImpls, but there are still
> threads running and my app won't exit.  I wanted to try out destroy
> on a simpler piece of code, so I modified the Rivers.java example to
> call display.destroy().  Nothing happened.  A call to
> Thread.activeCount() indicated that there were still 7 threads running.
>
> It seems that there must be some other threads somewhere that aren't
> being destroyed.  I understand that I may call System.exit(), but I'm
> trying to capture a series of images (in a for loop), so System.exit()
> isn't really what I want to do.
>
> Any other suggestions or hints of where to look for these everlasting
> threads?
>
> Thanks.
>
> Leah
>
>
> On Fri, 1 Aug 2003, Bill Hibbard wrote:
>
> > Hi Leah,
> >
> > There are one or more Threads inside a DisplayImpl. You
> > should be able to stop them with a call to the destroy()
> > method of each DisplayImpl. Or just call System.exit(0).
> >
> > Good luck,
> > Bill
> >
> > On Fri, 1 Aug 2003, Leah Heiss wrote:
> >
> > > Hello visad-list
> > >
> > > I have another question for you regarding offscreen image rendering.
> > >
> > > I've set a up a simple class to capture my images, but the process never
> > > completes -- my program never exits.  It seems to me that there must be
> > > some thread buried deep inside VisAD that isn't finishing.
> > >
> > >
> > > Here's the general outline of my code:
> > >
> > > public class ImageMaker{
> > >
> > >   public void main( String[] args ){
> > >           captureImages();
> > >           return;
> > >   }
> > >
> > >   private void captureImages(){
> > >           // create DisplayImpl
> > >           // add data to DisplayImpl
> > >           // call thread to capture images
> > >           Thread thread = new ImageCapturer( DisplayImpl disp );
> > >           thread.start();
> > >           System.out.println( "All Done!" );
> > >           return;
> > >   }
> > >
> > >   class ImageCapturer extends Thread{
> > >
> > >           // constructor
> > >
> > >           // run
> > >           public void run(){
> > >                   // get the image
> > >                   // write it to file
> > >                   System.out.println( "Thread Done!" );
> > >           }
> > >   }
> > > }
> > >
> > >
> > > I run the code with
> > > > java ImageMaker
> > > And see...
> > > All Done!
> > > Thread Done!
> > >
> > > But the prompt never comes back.  What is still running that won't let my
> > > program exit?
> > >
> > >
> > > Thanks for the help.
> > >
> > > Leah
> > >
> > >
> >
>
>


  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: