Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JUnit 4.13.2 Source Code Files
JUnit Source Code Files are provided in the source package file, junit-4.13.2-sources.jar.
You can browse JUnit Source Code files below:
✍: FYIcenter.com
⏎ org/junit/internal/management/ReflectiveThreadMXBean.java
package org.junit.internal.management; import org.junit.internal.Classes; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * Implementation of {@link ThreadMXBean} using the JVM reflectively. */ final class ReflectiveThreadMXBean implements ThreadMXBean { private final Object threadMxBean; private static final class Holder { static final Method getThreadCpuTimeMethod; static final Method isThreadCpuTimeSupportedMethod; private static final String FAILURE_MESSAGE = "Unable to access ThreadMXBean"; static { Method threadCpuTime = null; Method threadCpuTimeSupported = null; try { Class<?> threadMXBeanClass = Classes.getClass("java.lang.management.ThreadMXBean"); threadCpuTime = threadMXBeanClass.getMethod("getThreadCpuTime", long.class); threadCpuTimeSupported = threadMXBeanClass.getMethod("isThreadCpuTimeSupported"); } catch (ClassNotFoundException e) { // do nothing, the methods will be null on failure } catch (NoSuchMethodException e) { // do nothing, the methods will be null on failure } catch (SecurityException e) { // do nothing, the methods will be null on failure } getThreadCpuTimeMethod = threadCpuTime; isThreadCpuTimeSupportedMethod = threadCpuTimeSupported; } } ReflectiveThreadMXBean(Object threadMxBean) { super(); this.threadMxBean = threadMxBean; } /** * {@inheritDoc} */ public long getThreadCpuTime(long id) { if (Holder.getThreadCpuTimeMethod != null) { Exception error = null; try { return (Long) Holder.getThreadCpuTimeMethod.invoke(threadMxBean, id); } catch (ClassCastException e) { error = e; // fallthrough } catch (IllegalAccessException e) { error = e; // fallthrough } catch (IllegalArgumentException e) { error = e; // fallthrough } catch (InvocationTargetException e) { error = e; // fallthrough } throw new UnsupportedOperationException(Holder.FAILURE_MESSAGE, error); } throw new UnsupportedOperationException(Holder.FAILURE_MESSAGE); } /** * {@inheritDoc} */ public boolean isThreadCpuTimeSupported() { if (Holder.isThreadCpuTimeSupportedMethod != null) { try { return (Boolean) Holder.isThreadCpuTimeSupportedMethod.invoke(threadMxBean); } catch (ClassCastException e) { // fallthrough } catch (IllegalAccessException e) { // fallthrough } catch (IllegalArgumentException e) { // fallthrough } catch (InvocationTargetException e) { // fallthrough } } return false; } }
⏎ org/junit/internal/management/ReflectiveThreadMXBean.java
Or download all of them as a single archive file:
File name: junit-4.13.2-sources.jar File size: 234540 bytes Release date: 2021-02-13 Download
⇒ Download and Install junit-4.12.jar
⇐ Download and Install junit-4.13.2.jar
2016-03-28, 11141👍, 0💬
Popular Posts:
Apache Axis2 is the core engine for Web services. It is a complete re-design and re-write of the wid...
XML Serializer, Release 2.7.1, allows you to write out XML, HTML etc. as a stream of characters from...
JDK 6 tools.jar is the JAR file for JDK 6 tools. It contains Java classes to support different JDK t...
JDK 11 jdk.jdeps.jmod is the JMOD file for JDK 11 JDeps tool, which can be invoked by the "jdeps" co...
JDK 8 jconsole.jar is the JAR file for JDK 8 JConsole, which is a graphical monitoring tool to monit...