-
CSR
-
Resolution: Approved
-
P5
-
None
-
behavioral
-
minimal
-
Removing the synchronized modifier from Color.createContext() has no impact on existing callers, as the method does not access any shared mutable state.
-
Java API
-
SE
Summary
Remove the synchronized keyword from java.awt.Color.createContext()
Problem
java.awt.Color.createContext() is still marked as synchronized despite no longer accessing shared mutable state. This introduces unnecessary synchronization overhead which can degrade performance in multi-threaded rendering scenarios.
Solution
Drop the "synchronized" keyword from the java.awt.Color#createContext() method to reduce the overhead of the method in multi-core environments.
Specification
java/awt/Color.java
- public synchronized PaintContext createContext(ColorModel cm, Rectangle r,
- Rectangle2D r2d,
- AffineTransform xform,
- RenderingHints hints) {
+ public PaintContext createContext(ColorModel cm, Rectangle r,
+ Rectangle2D r2d, AffineTransform xform,
+ RenderingHints hints) {
- csr of
-
JDK-8355078 java.awt.Color.createContext() uses unnecessary synchronization
-
- Resolved
-