@@ -260,13 +260,14 @@ public SunThreadMxBean(ThreadMXBean underlying) {
260260 super (underlying );
261261 this .real = underlying ;
262262 try {
263- getThreadUserTimeMethod = real .getClass ().getMethod ("getThreadUserTime" , long [].class );
264- isThreadAllocatedMemoryEnabledMethod = real .getClass ().getMethod ("isThreadAllocatedMemoryEnabled" );
265- setThreadAllocatedMemoryEnabledMethod = real .getClass ().getMethod ("setThreadAllocatedMemoryEnabled" , Boolean .TYPE );
266- getThreadAllocatedBytesMethod1 = real .getClass ().getMethod ("getThreadAllocatedBytes" , Long .TYPE );
267- getThreadAllocatedBytesMethod2 = real .getClass ().getMethod ("getThreadAllocatedBytes" , long [].class );
268- isThreadAllocatedMemorySupportedMethod = real .getClass ().getMethod ("isThreadAllocatedMemorySupported" );
269- getThreadCpuTimeMethod = real .getClass ().getMethod ("getThreadCpuTime" , long [].class );
263+ Class <?> cls = Class .forName ("com.sun.management.ThreadMXBean" );
264+ getThreadUserTimeMethod = cls .getMethod ("getThreadUserTime" , long [].class );
265+ isThreadAllocatedMemoryEnabledMethod = cls .getMethod ("isThreadAllocatedMemoryEnabled" );
266+ setThreadAllocatedMemoryEnabledMethod = cls .getMethod ("setThreadAllocatedMemoryEnabled" , Boolean .TYPE );
267+ getThreadAllocatedBytesMethod1 = cls .getMethod ("getThreadAllocatedBytes" , Long .TYPE );
268+ getThreadAllocatedBytesMethod2 = cls .getMethod ("getThreadAllocatedBytes" , long [].class );
269+ isThreadAllocatedMemorySupportedMethod = cls .getMethod ("isThreadAllocatedMemorySupported" );
270+ getThreadCpuTimeMethod = cls .getMethod ("getThreadCpuTime" , long [].class );
270271
271272 getThreadUserTimeMethod .setAccessible (true );
272273 isThreadAllocatedMemoryEnabledMethod .setAccessible (true );
0 commit comments