@@ -248,13 +248,14 @@ public SunThreadMxBean(ThreadMXBean underlying) {
248248 super (underlying );
249249 this .real = underlying ;
250250 try {
251- getThreadUserTimeMethod = real .getClass ().getMethod ("getThreadUserTime" , long [].class );
252- isThreadAllocatedMemoryEnabledMethod = real .getClass ().getMethod ("isThreadAllocatedMemoryEnabled" );
253- setThreadAllocatedMemoryEnabledMethod = real .getClass ().getMethod ("setThreadAllocatedMemoryEnabled" , Boolean .TYPE );
254- getThreadAllocatedBytesMethod1 = real .getClass ().getMethod ("getThreadAllocatedBytes" , Long .TYPE );
255- getThreadAllocatedBytesMethod2 = real .getClass ().getMethod ("getThreadAllocatedBytes" , long [].class );
256- isThreadAllocatedMemorySupportedMethod = real .getClass ().getMethod ("isThreadAllocatedMemorySupported" );
257- getThreadCpuTimeMethod = real .getClass ().getMethod ("getThreadCpuTime" , long [].class );
251+ Class <?> cls = Class .forName ("com.sun.management.ThreadMXBean" );
252+ getThreadUserTimeMethod = cls .getMethod ("getThreadUserTime" , long [].class );
253+ isThreadAllocatedMemoryEnabledMethod = cls .getMethod ("isThreadAllocatedMemoryEnabled" );
254+ setThreadAllocatedMemoryEnabledMethod = cls .getMethod ("setThreadAllocatedMemoryEnabled" , Boolean .TYPE );
255+ getThreadAllocatedBytesMethod1 = cls .getMethod ("getThreadAllocatedBytes" , Long .TYPE );
256+ getThreadAllocatedBytesMethod2 = cls .getMethod ("getThreadAllocatedBytes" , long [].class );
257+ isThreadAllocatedMemorySupportedMethod = cls .getMethod ("isThreadAllocatedMemorySupported" );
258+ getThreadCpuTimeMethod = cls .getMethod ("getThreadCpuTime" , long [].class );
258259
259260 getThreadUserTimeMethod .setAccessible (true );
260261 isThreadAllocatedMemoryEnabledMethod .setAccessible (true );
0 commit comments