Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Headless Cocoa/Java app - autorelease



No action on java-dev... thought I'd try here.

Has anyone run JBoss on OSX AND needed to access Cocoa APIs ?

I've got this web app that needs to generate PNG and EPS image files on the fly.
When creating NSImage instances, I'm getting:
<x-tad-bigger>2005-05-01 18:01:19.750 java[4011] *** _NSAutoreleaseNoPool(): Object 0x4e29d930 of class NSImageCacheView autoreleased with no pool in place - just leaking</x-tad-bigger>
<x-tad-bigger>2005-05-01 18:01:19.751 java[4011] *** _NSAutoreleaseNoPool(): Object 0x4e29d930 of class NSImageCacheView autoreleased with no pool in place - just leaking</x-tad-bigger>

I've read up on the NSAutoreleasePool stuff, and am using the following to launch JBoss:
public class Main {
public Main() {
super();
}
public static void main(final String[] args) {
Runnable worker = new Runnable() {

public void run() {
try {
int pool = NSAutoreleasePool.push();
org.jboss.Main main = new org.jboss.Main();
main.boot(args);
NSAutoreleasePool.pop(pool);
} catch (Exception e) {
System.err.println("Failed to boot JBoss:");
e.printStackTrace();
}
}
};
int pool = NSAutoreleasePool.push();
NSApplication app = NSApplication.sharedApplication();
ThreadGroup threads = new ThreadGroup("jboss");
new Thread(threads, worker, "main").start();
NSAutoreleasePool.pop(pool);
}
}

So, both the main thread, and the jboss thread have NSAutoreleasePools in place.

Now, JBoss has worker threads that process incoming requests, AND I spawn my own threads to handle the actual image processing. Do the sub-threads need AutoreleasePools as well ?

Thanks.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

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 © 2007 Apple Inc. All rights reserved.