[OpenJDK 2D-Dev] [10] Review Request: 8183576 Synchronization in BufferedImage.setRGB(int x, int y, int rgb) is not necessary

Phil Race philip.race at oracle.com
Wed Jul 5 17:46:12 UTC 2017

This seems anomalous to me too. I don't see any likely real problem with 
removing it ..


On 07/05/2017 10:31 AM, Sergey Bylokhov wrote:
> Hello,
> Please review the fix for jdk10.
> Bug: https://bugs.openjdk.java.net/browse/JDK-8183576
> Webrev can be found at: http://cr.openjdk.java.net/~serb/8183576/webrev.00
> The method setRGB(int x, int y, int rgb) in BufferedImage is synchronized, but all other methods in this class are not. For example the similar method:
>    setRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)
> and get methods:
>    getRGB(int x, int y)
>    getRGB(int, int, int, int, int[], int, int).
> Since the BufferedImage class is not thread-safe it is unclear why the only this method was marked as synchronized.
> (Other possible fix: mark this class as a thread-safe and synchronize access to internal data in other methods).
> CSR will created after technical review.

More information about the 2d-dev mailing list