jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java
changeset 2695 d75c6ebf3ac6
parent 2 90ce3da70b43
child 5506 202f599c92aa
equal deleted inserted replaced
2694:ab517576696d 2695:d75c6ebf3ac6
    93      * A specific instance of the {@code RenderingEngine} can be
    93      * A specific instance of the {@code RenderingEngine} can be
    94      * chosen by specifying the runtime flag:
    94      * chosen by specifying the runtime flag:
    95      * <pre>
    95      * <pre>
    96      *     java -Dsun.java2d.renderer=&lt;classname&gt;
    96      *     java -Dsun.java2d.renderer=&lt;classname&gt;
    97      * </pre>
    97      * </pre>
       
    98      *
       
    99      * If no specific {@code RenderingEngine} is specified on the command
       
   100      * or Ductus renderer is specified, it will attempt loading the
       
   101      * sun.dc.DuctusRenderingEngine class using Class.forName as a fastpath;
       
   102      * if not found, use the ServiceLoader.
    98      * If no specific {@code RenderingEngine} is specified on the command
   103      * If no specific {@code RenderingEngine} is specified on the command
    99      * line then the last one returned by enumerating all subclasses of
   104      * line then the last one returned by enumerating all subclasses of
   100      * {@code RenderingEngine} known to the ServiceLoader is used.
   105      * {@code RenderingEngine} known to the ServiceLoader is used.
   101      * <p>
   106      * <p>
   102      * Runtime tracing of the actions of the {@code RenderingEngine}
   107      * Runtime tracing of the actions of the {@code RenderingEngine}
   113         }
   118         }
   114 
   119 
   115         reImpl = (RenderingEngine)
   120         reImpl = (RenderingEngine)
   116             AccessController.doPrivileged(new PrivilegedAction() {
   121             AccessController.doPrivileged(new PrivilegedAction() {
   117                 public Object run() {
   122                 public Object run() {
       
   123                     final String ductusREClass = "sun.dc.DuctusRenderingEngine";
   118                     String reClass =
   124                     String reClass =
   119                         System.getProperty("sun.java2d.renderer",
   125                         System.getProperty("sun.java2d.renderer", ductusREClass);
   120                                            "sun.dc.DuctusRenderingEngine");
   126                     if (reClass.equals(ductusREClass)) {
       
   127                         try {
       
   128                             Class cls = Class.forName(ductusREClass);
       
   129                             return cls.newInstance();
       
   130                         } catch (ClassNotFoundException x) {
       
   131                             // not found
       
   132                         } catch (IllegalAccessException x) {
       
   133                             // should not reach here
       
   134                         } catch (InstantiationException x) {
       
   135                             // should not reach here
       
   136                         }
       
   137                     }
   121 
   138 
   122                     ServiceLoader<RenderingEngine> reLoader =
   139                     ServiceLoader<RenderingEngine> reLoader =
   123                         ServiceLoader.loadInstalled(RenderingEngine.class);
   140                         ServiceLoader.loadInstalled(RenderingEngine.class);
   124 
   141 
   125                     RenderingEngine service = null;
   142                     RenderingEngine service = null;