Mailing Lists: Apple Mailing Lists

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

Re: Threaded java cocoa apps



John Macnamara wrote:
| I just tried to make my application communicate with its database in
| the background by putting the db access code into it's own thread.
| However if I click on any element in my application I get the spinning
| ball until the db access is completed... Just wondering if this is a
| drawback of using java with cocoa, or is it something I am missing, do
| I have to do the multithreading in cocoa instead?

As with any application, the Spinning Beachball of Death means that your
event loop has been blocked. Whatever the problem is, it's just something
you're missing. (Cocoa threads are the same as Java threads under the hood.)

I'd guess that clicking a UI element causes a deadlock between the UI and
database threads: the UI is waiting for the database thread to do something,
while the database thread is waiting for the UI to do something. Generally,
thread A should be *very* careful if it tries to use data managed by thread
B. The UI thread has to be extra careful.

Glen Fisher

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

This email sent to email@hidden

References: 
 >Threaded java cocoa apps (From: John Macnamara <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.