Search in sources :

Example 1 with IgnoreJRERequirement

use of org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement in project felix by apache.

the class ThreadDump method call.

@IgnoreJRERequirement
public String call() throws Exception {
    ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
    StringBuffer b = new StringBuffer("Thread dump\n");
    ThreadInfo[] infos = threadMXBean.dumpAllThreads(threadMXBean.isObjectMonitorUsageSupported(), threadMXBean.isSynchronizerUsageSupported());
    for (int i = 0; i < infos.length; i++) {
        ThreadInfo ti = infos[i];
        b.append("\n\nThreadId: ").append(ti.getThreadId()).append(" : name: ").append(ti.getThreadName()).append(" State: ").append(ti.getThreadState());
        b.append("\n  LockInfo: ").append(ti.getLockInfo()).append(" LockOwnerId: ").append(ti.getLockOwnerId()).append(" LockOwnerName: ").append(ti.getLockOwnerName());
        StackTraceElement[] stackTrace = ti.getStackTrace();
        for (int j = 0; j < stackTrace.length; j++) {
            b.append("\n  ").append(stackTrace[j]);
        }
    }
    return b.toString();
}
Also used : ThreadMXBean(java.lang.management.ThreadMXBean) ThreadInfo(java.lang.management.ThreadInfo) IgnoreJRERequirement(org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement)

Example 2 with IgnoreJRERequirement

use of org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement in project support-core-plugin by jenkinsci.

the class FileDescriptorLimit method getOpenFileDescriptorCount.

/**
 * * Using OperatingSystemMXBean, we can obtain the total number of open file descriptors.
 */
// UnixOperatingSystemMXBean
@IgnoreJRERequirement
private static void getOpenFileDescriptorCount(PrintWriter writer) {
    try {
        OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
        if (operatingSystemMXBean instanceof UnixOperatingSystemMXBean) {
            UnixOperatingSystemMXBean unixOperatingSystemMXBean = (UnixOperatingSystemMXBean) operatingSystemMXBean;
            writer.println("Open File Descriptor Count: " + unixOperatingSystemMXBean.getOpenFileDescriptorCount());
        } else {
            writer.println("Wrong bean: " + operatingSystemMXBean);
        }
    } catch (LinkageError e) {
        writer.println("Unable to get the total number of open file descriptors using OperatingSystemMXBean");
    }
}
Also used : UnixOperatingSystemMXBean(com.sun.management.UnixOperatingSystemMXBean) UnixOperatingSystemMXBean(com.sun.management.UnixOperatingSystemMXBean) OperatingSystemMXBean(java.lang.management.OperatingSystemMXBean) IgnoreJRERequirement(org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement)

Example 3 with IgnoreJRERequirement

use of org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement in project grpc-java by grpc.

the class JndiResourceResolverTest method jndiResolverWorks.

@IgnoreJRERequirement
@Test
public void jndiResolverWorks() throws Exception {
    Assume.assumeNoException(new JndiResourceResolverFactory().unavailabilityCause());
    RecordFetcher recordFetcher = new JndiRecordFetcher();
    try {
        recordFetcher.getAllRecords("SRV", "dns:///localhost");
    } catch (javax.naming.CommunicationException e) {
        Assume.assumeNoException(e);
    } catch (javax.naming.NameNotFoundException e) {
        Assume.assumeNoException(e);
    }
}
Also used : JndiRecordFetcher(io.grpc.internal.JndiResourceResolverFactory.JndiRecordFetcher) RecordFetcher(io.grpc.internal.JndiResourceResolverFactory.RecordFetcher) JndiRecordFetcher(io.grpc.internal.JndiResourceResolverFactory.JndiRecordFetcher) IgnoreJRERequirement(org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement) Test(org.junit.Test)

Aggregations

IgnoreJRERequirement (org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement)3 UnixOperatingSystemMXBean (com.sun.management.UnixOperatingSystemMXBean)1 JndiRecordFetcher (io.grpc.internal.JndiResourceResolverFactory.JndiRecordFetcher)1 RecordFetcher (io.grpc.internal.JndiResourceResolverFactory.RecordFetcher)1 OperatingSystemMXBean (java.lang.management.OperatingSystemMXBean)1 ThreadInfo (java.lang.management.ThreadInfo)1 ThreadMXBean (java.lang.management.ThreadMXBean)1 Test (org.junit.Test)1