Name: agR10216 Date: 06/27/2003
Prior to the fix for 4259272 (Support Notifications of Clipboard
Contents Changes) ClipboardOwner.lostOwnership() was called
directly in the Clipboard.setContents(), but with the fix for
4259272 a request for lostOwnership() invocation is posted to the
event dispatch thread.
Because the current asynchronous notification may seem
unconformable to the specification, the fact that lostOwnership()
may not be called synchronously should be documented.
Name: agR10216 Date: 07/15/2003
The following CCC request was approved:
4884956: REGRESSION:datatransfer.Clipboard.setContent deals with the queue now
Prior to the fix 4259272 java.awt.datatransfer.ClipboardOwner's
lostOwnership() was called directly from
java.awt.datatransfer.Clipboard.setContents(). With the fix
4259272 a request for invocation of lostOwnership() is posted to the
event dispatch thread. This change was necessary to properly fix
4259272, the change was described in the bug report and the CCC
request 4259272 was approved.
The spec of Clipboard.setContents() says:
"If there is an existing owner registered, that owner is notified
that it no longer holds ownership of the clipboard contents."
There is no anything about whether that notification is
synchronous or asynchronous, i.e. lostOwnership() is called
directly from this method or not. Besides, it's typical of AWT to
notify listeners asynchronously. So no one should have relied on
the synchronous behavior. But it's worthwhile to clarify this to
have the failed JCK test properly updated.
Java Drag and Drop team
Clarify the current behavoir with respect to notifying
ClipboardOwner. Conjointly it's also worthwhile to clarify that
FlavorListeners may not be notified synchronously. The fix
4259272 added the possibility of notification of FlavorListeners
and that notification is asynchronous.
exported external method java.awt.Clipboard.setContents
* Sets the current contents of the clipboard to the specified
* transferable object and registers the specified clipboard owner
! * as the owner of the new contents.
! * <p>
! * If there is an existing owner different from the argument
! * <code>owner</code>, that owner is notified that it no longer
! * holds ownership of the clipboard contents via an invocation
! * of <code>ClipboardOwner.lostOwnership()</code> on that owner.
! * An implementation of <code>setContents()</code> is free not
! * to invoke <code>lostOwnership()</code> directly from this method.
! * For example, <code>lostOwnership()</code> may be invoked later on
! * a different thread. The same applies to <code>FlavorListener</code>s
! * registered on this clipboard.
! * <p>
! * The method throws <code>IllegalStateException</code> if the clipboard
! * is currently unavailable. For example, on some platforms, the system
! * clipboard is unavailable while it is accessed by another application.
* @param contents the transferable object representing the
* clipboard content
* @param owner the object which owns the clipboard content
* @throws IllegalStateException if the clipboard is currently unavailable
* @see java.awt.Toolkit#getSystemClipboard
public synchronized void setContents(Transferable contents, ClipboardOwner owner)