Search Results

Search found 1 results on 1 pages for 'gwin003'.

Page 1/1 | 1 

  • Java Daemon Threading with JNI

    - by gwin003
    I have a Java applet that creates a new non-daemon thread like so: Thread childThread = new Thread(new MyRunnable(_this)); childThread.setDaemon(false); childThread.start(); Then my MyRunnable object calls a native method that is implemented in C++: @Override public void run() { while (true) { if (!ran) { System.out.println("isDaemon: " + Thread.currentThread().isDaemon()); _applet.invokePrintManager(_applet.fFormType, _applet.fFormName, _applet.fPrintImmediately, _applet.fDataSet); ran = true; } } } This C++ method calls into a C# DLL that shows a form. My problem is, whenever the user navigates away from the page with a Java applet on it, JVM (and my C# form) is killed. I need the form and JVM to remain open until it is closed by the user. I tried setting my thread to be a non-daemon thread, which is working because System.out.println("isDaemon: " + Thread.currentThread().isDaemon() prints isDaemon: false. Is there something related to the way that the C# form is created (is there another thread I'm not accounting for) or something I am overlooking?? My thread is not a daemon thread, but the JVM is being killed anyways.

    Read the article

1