<AWT Dev> [9] Review Request: 8037485 Refactor java.awt.datatransfer to eliminate dependency on AWT

Alan Bateman Alan.Bateman at oracle.com
Tue Jul 22 15:08:24 UTC 2014

On 22/07/2014 15:04, Petr Pchelko wrote:
> Hello,
> I've updated the fix. The new version is located here:
> http://cr.openjdk.java.net/~pchelko/9/8037485/webrev.01/ 
> <http://cr.openjdk.java.net/%7Epchelko/9/8037485/webrev.01/>
> I've reverted RMI changes as they will be handled separately.
> Also I've changed package names, now the internal part of the 
> datatransfer module is called sun.datatransfer. This allowed to make 
> less renamings and leave sun.awt.datatransfer package as is.
> With best regards. Petr.
I'm skimmed over the changes (not a detailed review, best for someone 
working in this area to do that). It looks much better to me. We can 
deal with the optional dependency on RMI separately.

I've mostly focused on the ServiceLoader usage in this webrev. The only 
concern is that getDesktopService is "static synchronized" so that you 
cause contention.  You could replace this with a lazy holder idiom, or 
just make make desktopService volatile, it shouldn't matter if multiple 
threads cause desktopDatatransferService is set more than once. A 
suggestion for getFlavorMap is use "FlavorMap map = this.flavorMap" and 
check it for null to avoid doing two volatile reads.

A minor type on the declaration of flavorMap, it reads "if there is not 
Desktop module", I think you mean "if there is not a desktop" or "if 
there isn't a desktop module".

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20140722/3eaf299c/attachment.html>

More information about the awt-dev mailing list