SandishKumarHN commented on issue #7227: Prohibit static, non-final fields
URL: 
https://github.com/apache/incubator-druid/issues/7227#issuecomment-524967349
 
 
   @leventov isn't this about removing all "static fields that are not final" 
fields? and adding structural search rule.
   
   What happens to the below code in the case of Prohibit "static fields that 
are not final"?
   
    ```
    private static final Logger log = new 
Logger(AllocationMetricCollectors.class);
     private static Method getThreadAllocatedBytes;
     private static ThreadMXBean threadMXBean;
     private static boolean initialized = false;
   
     static {
       try {
         // classes in the sun.* packages are not part of the public/supported 
Java API and should not be used directly.
         threadMXBean = ManagementFactory.getThreadMXBean();
         getThreadAllocatedBytes = 
threadMXBean.getClass().getMethod("getThreadAllocatedBytes", long[].class);
         getThreadAllocatedBytes.setAccessible(true);
         getThreadAllocatedBytes.invoke(threadMXBean, (Object) 
threadMXBean.getAllThreadIds());
         initialized = true;
       }
       catch (Exception e) {
         log.warn(e, "Cannot initialize %s", 
AllocationMetricCollector.class.getName());
       }
     }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to