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: Java-dev Digest, Vol 3, Issue 14



Le 11/01/06 21:03, « email@hidden »
<email@hidden> a écrit :

> Send Java-dev mailing list submissions to
> email@hidden
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.apple.com/mailman/listinfo/java-dev
> or, via email, send a message with subject or body 'help' to
> email@hidden
> 
> You can reach the person managing the list at
> email@hidden
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Java-dev digest..."
> 
> 
> Today's Topics:
> 
>  1. Universal JavaApplicationStub - Jar Bundler doesn't give it
>     to me. (Scott Palmer)
>  2. Re: SwingUtilities.invokeLater hang or deadlock (Tex Clayton)
>  3. Re: SwingUtilities.invokeLater hang or deadlock (Greg Guerin)
>  4. JTextField String drop notification (Jeff Martin)
>  5. Re: Universal JavaApplicationStub - Jar Bundler doesn't give
>     it to me. (Greg Guerin)
>  6. Re: JTextField String drop notification (Scott Palmer)
>  7. Re: SwingUtilities.invokeLater hang or deadlock (Michael Hall)
>  8. Re: JTextField String drop notification (Jeff Martin)
>  9. Re: Universal JavaApplicationStub - Jar Bundler doesn't give
>     it to    me. (Scott Palmer)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Wed, 11 Jan 2006 12:08:15 -0500
> From: Scott Palmer <email@hidden>
> Subject: Universal JavaApplicationStub - Jar Bundler doesn't give it
> to me.
> To: Java List Apple <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> 
> I have XCode 2.2 installed.
> 
> Jar Bundler claims to be Version 10.0.2 (10.0.2)
> 
> I just created a mostly empty application bundle with Jar Bundler.  I
> just typed a main class name and created the bundle, no resources of
> any sort were added. It was just a test to try to get a copy of the
> JavaApplicationStub so I could integrate it into my "real" build
> scripts.
> 
> The info for the JavaApplicationStub that it put in the bundle shows...
> Kind: Unix Executable File (PowerPC)
> Size: 24 KB
> I have an OLDER stub that is larger, 52kB, and it also claims to be a
> unix executable file for PowerPC)
> 
> Whereas the info for /Developer/Applications/Java Tools/Jar
> Bundler.app/Contents/MacOS/Jar Bundler  shows...
> Kind: Unix Executable File (Universal)
> 
> indicating that it was obviously compiled at a time after the
> introduction of universal binaries.
> 
> Why didn't Jar Bundler place a universal JavaApplicationStub in my
> bundle?
> 
> 
> Scott
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Wed, 11 Jan 2006 12:15:31 -0500
> From: Tex Clayton <email@hidden>
> Subject: Re: SwingUtilities.invokeLater hang or deadlock
> To: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> 
> 
> On Jan 10, 2006, at 5:52 PM, "charles chen" <email@hidden>
> wrote:
> 
>> Found one Java-level deadlock:
>> =============================
>> "Thread-39":
>> waiting to lock monitor 0x1802eb8 (object 0x4dc891b8, a
>> java.awt.EventQueue),
>> which is held by "AWT-AppKit"
>> "AWT-AppKit":
>> waiting to lock monitor 0x1802f90 (object 0x4dc891a0, a
>> sun.awt.PostEventQueue),
>> which is held by "Thread-39"
>> 
>> Java stack information for the threads listed above:
>> ===================================================
>> "Thread-39":
>> at java.awt.EventQueue.postEventPrivate(EventQueue.java:211)
>> - waiting to lock <0x4dc891b8> (a java.awt.EventQueue)
>> at java.awt.EventQueue.postEvent(EventQueue.java:198)
>> at sun.awt.PostEventQueue.flush(SunToolkit.java:713)
>> - locked <0x4dc891a0> (a sun.awt.PostEventQueue)
>> at sun.awt.SunToolkit.flushPendingEvents(SunToolkit.java:350)
>> at java.awt.EventQueue.postEvent(EventQueue.java:197)
>> at java.awt.EventQueue.invokeLater(EventQueue.java:816)
>> at javax.swing.SwingUtilities.invokeLater(SwingUtilities.java:1170)
>> at digilabs.CalFrame.ReportProgress(CalFrame.java:5246)
>> at digilabs.io.ZipPackage.ZipFile(ZipPackage.java:199)
>> at digilabs.io.ZipPackage.DoArchive(ZipPackage.java:146)
>> at digilabs.io.ZipPackage.Archive(ZipPackage.java:122)
>> at digilabs.spool.JobUploader.CreatePackageSynch(JobUploader.java:969)
>> at digilabs.spool.JobUploader.DoCreatePackage(JobUploader.java:185)
>> at digilabs.spool.RemoteJobsSpooler.PrintingDone
>> (RemoteJobsSpooler.java:77)
>> at digilabs.spool.Spooler.DonePrinting(Spooler.java:241)
>> at digilabs.spool.Spooler$2.run(Spooler.java:221)
>> at java.lang.Thread.run(Thread.java:552)
>> "AWT-AppKit":
>> at sun.awt.PostEventQueue.postEvent(SunToolkit.java:726)
>> - waiting to lock <0x4dc891a0> (a sun.awt.PostEventQueue)
>> at sun.awt.SunToolkit.postEvent(SunToolkit.java:337)
>> at apple.awt.CToolkit.postEvent(CToolkit.java:1001)
>> at apple.awt.EventFactoryProxy.forwardEvent(EventFactoryProxy.java:63)
> 
> Classic deadlock caused by two threads acquiring two locks in
> different order.
> Thread-39 locks the sun.awt.PostEventQueue, then attempts to lock the
> java.awt.EventQueue.
> AWT-AppKit lockst the java.awt.EventQueue (although I do not see that
> in the stack trace), then attempts to lock the sun.awt.PostEventQueue.
> 
> As you mentioned, the actual contents of the Runnable does not matter.
> 
> I don't suppose you're doing anything with Cocoa?  I know that doing
> some things from an ApplicationAdapter (handleQuit, etc.) may cause a
> deadlock, but I don't remember the details.
> 
> This looks like a case of Sun vs Apple to me.  That suggest that the
> bug is in Apple's code.  Please file a bug including this full thread
> dump.
> 
> A temporary hack of a workaround is to lock the java.awt.EventQueue
> before the call to invokeLater.  Unfortunately, there is no guarantee
> that the deadlock won't occur from other sources using invokeLater
> (see the TimerQueue thread in your dump).  Also, this workaround will
> actually be prey to deadlocks if Apple fixes their code to acquire
> the sun.awt.PostEventQueue first.
> 
> -Tex Clayton
> Dartware, LLC
> http://www.dartware.com
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Wed, 11 Jan 2006 11:56:14 -0700
> From: Greg Guerin <email@hidden>
> Subject: Re: SwingUtilities.invokeLater hang or deadlock
> To: email@hidden
> Message-ID: <l03130302bfeb00881cf0@[216.190.249.34]>
> Content-Type: text/plain; charset="us-ascii"
> 
> Michael Hall wrote:
> 
>> ...To
>> completely eliminate the possibility of a deadlock between the
>> application thread and either of the AWT threads wouldn't it need a
>> priority of 4?
> 
> It's impossible to eliminate deadlock possibilities by juggling priorities.
> I mean that in both an analytical/theoretical sense, as well as a
> real-world practical sense.  At best, juggling priorities will only shift
> when or where the conditions arise that lead to deadlock.  The problem is
> only shifted, though, not eliminated.  I have seen such attempts actually
> cause the deadlock to occur more often ("The best-laid schemes..." and all).
> 
> To eliminate the problem, the same sequence of lock acquisition must be
> used everywhere.  That means code has to be changed.
> 
> 
> Ben Galbraith wrote:
> 
>> Have we already discussed what exactly the Runnable submitted by
>> Thread-39 is doing? Can you submit the source of that Runnable, please?
> 
> See the list archives:
> <http://lists.apple.com/archives/java-dev/2006/Jan/msg00142.html>
>   4. "It doesn't matter what the code in the Runnable() is."
> 
> -- GG
> 
> 
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Wed, 11 Jan 2006 13:09:00 -0600
> From: Jeff Martin <email@hidden>
> Subject: JTextField String drop notification
> To: Java Dev <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> 
> So both Apple (with 1.4) and Sun (with 1.5) have now added automatic
> String drop support to all JTextFields. Unfortunately, I can't figure
> out a way to get notification that a string has been dropped on a
> text field. There is no support for a ChangeListener,  the
> ActionListener isn't notified, the text field doesn't gain focus and
> I can't differentiate DocumentListener changes from those made by
> updating the text field or performing edits on the text field.
> 
> The only solution that I see, that I hate, is that I could override
> the default textfield DropTarget on all text fields to catch the drop
> () myself. Any good Swing solution that I'm missing? Does everyone
> (anyone? :-) else handle text field string drops correctly in their
> apps?
> 
> jeff
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Wed, 11 Jan 2006 12:15:16 -0700
> From: Greg Guerin <email@hidden>
> Subject: Re: Universal JavaApplicationStub - Jar Bundler doesn't give
> it to me.
> To: email@hidden
> Message-ID: <l03130301bfeb00400c20@[216.190.249.34]>
> Content-Type: text/plain; charset="us-ascii"
> 
> Scott Palmer wrote:
> 
>> Why didn't Jar Bundler place a universal JavaApplicationStub in my bundle?
> 
> Under the following:
> OS: 10.4.2
> 'java -version': 1.4.2_09-232
> Xcode: 2.0
> Jar Bundler: 10.0.0
> 
> And providing only a "Foo" class-name plus my home-dir added to classpath,
> I *DO* get an app-bundle with a Universal stub, of ~44 KB.  It's identical
> to the framework file:
> .../JavaVM.framework/Resources/MacOS/JavaApplicationStub
> 
> I suggest looking inside JavaVM.framework for the prototype stub, which I'm
> pretty sure is where Jar Bundler gets it from.  I don't think Jar Bundler
> uses its own executable stub as its prototype.
> 
> 
>> I have an OLDER stub that is larger, 52kB, and it also claims to be a unix
>> executable file for PowerPC)
> 
> Stub size has increased AND DECREASED over its evolution.  At decreases, I
> think some code that had been in the stub was moved into a private
> framework, but I'm just guessing.
> 
> -- GG
> 
> 
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Wed, 11 Jan 2006 14:16:20 -0500
> From: Scott Palmer <email@hidden>
> Subject: Re: JTextField String drop notification
> To: Jeff Martin <email@hidden>
> Cc: Java Dev <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> 
> 
> On 11-Jan-06, at 2:09 PM, Jeff Martin wrote:
> 
>> So both Apple (with 1.4) and Sun (with 1.5) have now added
>> automatic String drop support to all JTextFields. Unfortunately, I
>> can't figure out a way to get notification that a string has been
>> dropped on a text field. There is no support for a ChangeListener,
> 
> No, JTextFields are backed by a document.  You should be able to get
> what you want with a DocumentListener.
> 
> someTextField.getDocument().addDocumentListener( new DocumentListener
> () {
>  public void removeUpdate(DocumentEvent e) { }
>  public void insertUpdate(DocumentEvent e) { }
>  public void changedUpdate(DocumentEvent e) { }
> } );
> 
> 
> Scott
> 
> 
> 
> ------------------------------
> 
> Message: 7
> Date: Wed, 11 Jan 2006 13:17:58 -0600
> From: Michael Hall <email@hidden>
> Subject: Re: SwingUtilities.invokeLater hang or deadlock
> To: Greg Guerin <email@hidden>
> Cc: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> 
> 
>> The problem is
>> only shifted, though, not eliminated.  I have seen such attempts
>> actually
>> cause the deadlock to occur more often ("The best-laid schemes..."
>> and all).
>> 
> 
> I could imagine situations where the underlying problem was a 'race
> condition' when thread scheduling might make a difference in who won
> the race. I would think it impossible though to guarantee even
> scheduling order with 3 threads and 2 priorities which was more or
> less what I was arguing since AWT-AppKit seemed involved.
> 
> 
> Mike Hall        mikehall at spacestar dot net
> http://www.spacestar.net/users/mikehall
> http://sourceforge.net/projects/macnative
> 
> 
> 
> 
> 
> ------------------------------
> 
> Message: 8
> Date: Wed, 11 Jan 2006 13:27:35 -0600
> From: Jeff Martin <email@hidden>
> Subject: Re: JTextField String drop notification
> To: Scott Palmer <email@hidden>
> Cc: Java Dev <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> 
> Yeah, but those notifications (insert in particular) get called
> whenever the user types a character and whenever JTextField.setText()
> is called. I'm really looking for a way to nail down that a drop
> happened, or at least that a "bulk insert" happened.
> 
> jeff
> 
> 
> On Jan 11, 2006, at 1:16 PM, Scott Palmer wrote:
> 
>> 
>> On 11-Jan-06, at 2:09 PM, Jeff Martin wrote:
>> 
>>> So both Apple (with 1.4) and Sun (with 1.5) have now added
>>> automatic String drop support to all JTextFields. Unfortunately, I
>>> can't figure out a way to get notification that a string has been
>>> dropped on a text field. There is no support for a ChangeListener,
>> 
>> No, JTextFields are backed by a document.  You should be able to
>> get what you want with a DocumentListener.
>> 
>> someTextField.getDocument().addDocumentListener( new
>> DocumentListener() {
>>   public void removeUpdate(DocumentEvent e) { }
>>   public void insertUpdate(DocumentEvent e) { }
>>   public void changedUpdate(DocumentEvent e) { }
>> } );
>> 
>> 
>> Scott
> 
> 
> 
> ------------------------------
> 
> Message: 9
> Date: Wed, 11 Jan 2006 14:37:33 -0500
> From: Scott Palmer <email@hidden>
> Subject: Re: Universal JavaApplicationStub - Jar Bundler doesn't give
> it to    me.
> To: Java Dev <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> 
> 
> On 11-Jan-06, at 2:15 PM, Greg Guerin wrote:
> 
>> Scott Palmer wrote:
>> 
>>> Why didn't Jar Bundler place a universal JavaApplicationStub in my
>>> bundle?
>> 
>> Under the following:
>>   OS: 10.4.2
>>   'java -version': 1.4.2_09-232
>>   Xcode: 2.0
>>   Jar Bundler: 10.0.0
>> 
>> And providing only a "Foo" class-name plus my home-dir added to
>> classpath,
>> I *DO* get an app-bundle with a Universal stub, of ~44 KB.  It's
>> identical
>> to the framework file:
>>   .../JavaVM.framework/Resources/MacOS/JavaApplicationStub
>> 
>> I suggest looking inside JavaVM.framework for the prototype stub,
>> which I'm
>> pretty sure is where Jar Bundler gets it from.  I don't think Jar
>> Bundler
>> uses its own executable stub as its prototype.
> 
> Interesting!
> 
> When I show info for:
> /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/
> JavaApplicationStub
> (which indirectly refers to JavaVM.framework/Versions/A/Resources/
> MacOS/JavaApplicationStub)
> 
> I get a PowerPC stub, not a universal stub.  It is dated December
> 20th 2005 2:00PM
> Oddly close to the time a certain announcement ("J2SE 5.0 Release 4
> Developer Preview 3 Now Available!") was made on this list.
> 
> I will mention now (should have thought to mention this before) that
> I installed "J2SE 5.0 Release 4 Developer Preview 3" late last year.
> 
> I suppose that means I probably can't discuss the problem further on
> this public list without evil Apple lawyers hunting me down. :-)  I
> wonder if Apple will ever go back to using the java-seed list?
> 
> I've submitted a bug report on J2SE50R4DP3
> 
> Thanks,
> 
> Scott
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> Java-dev mailing list
> email@hidden
> http://lists.apple.com/mailman/listinfo/java-dev
> 
> End of Java-dev Digest, Vol 3, Issue 14
> ***************************************
> 
Help.... En français, s'il vous plait,
Merci,
Marc SUDRET


 _______________________________________________
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



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.