Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: JVM crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JVM crash



Greg Guerin wrote:

Jamison Hope wrote:

You should be fine. The JSheets example code does this. The native
part uses performSelectorOnMainThread: to do Cocoa GUI stuff on
Thread 0, and then the "didEndSelector" callbacks (which are also
run on Thread 0) attach to the JVM, do JNI to invoke a Java method,
and then detach from the JVM. The Java methods use
EventQueue#invokeLater (or SwingUtilities#invokeLater, same thing)
to push execution back onto the EDT.


Thanks for the (re)pointer.  I skimmed JSheets looking for this kind
of thing, but I obviously missed it.


TN 2147 also explicitly documents this:
    http://developer.apple.com/technotes/tn2005/tn2147.html#TNTAG26

My JNI code also does a lot of callbacks from AppKit into Java. Mostly, it just queues things to be done on other (Java) threads. Some of my stuff is a bit more involved (e.g. processing WebKitView callbacks), but pretty much sticks to manipulating local intrinsic types and my own objects (no Swing, AWT, wait/notify, etc.). There *ARE* monitor acquisitions on the AppKit thread, and these have not caused any trouble so far. For example, calling SwingUtilities.invokeLater acquires a monitor when manipulating the AWT EventQueue.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.