Examples of findMonitorDeadlockedThreads()


Examples of java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()

        out.println("<pre>");

        out.println("Report generated at " + new java.util.Date());

        long[] deadLockedIds = mx.findMonitorDeadlockedThreads();
        ThreadInfo[] infos;
        if (deadLockedIds != null) {
            infos = mx.getThreadInfo(deadLockedIds, Integer.MAX_VALUE);
            out.println("\nDead locks:");
            for (int i = 0; i < infos.length; i++) {
View Full Code Here

Examples of java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()

        ((IoSession) c1.get()).write( "start" );

        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();

        while ( !messageCount.await( 100, TimeUnit.MILLISECONDS ) ) {
            long[] threads = threadMXBean.findMonitorDeadlockedThreads();

            if ( null != threads ) {
                StringBuffer sb = new StringBuffer( 256 );
                ThreadInfo[] infos = threadMXBean.getThreadInfo( threads, Integer.MAX_VALUE );
View Full Code Here

Examples of java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()

        c1.get().write("start");

        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();

        while (!messageCount.await(100, TimeUnit.MILLISECONDS)) {
            long[] threads = threadMXBean.findMonitorDeadlockedThreads();

            if (null != threads) {
                StringBuffer sb = new StringBuffer(256);
                ThreadInfo[] infos = threadMXBean.getThreadInfo(threads, Integer.MAX_VALUE);
View Full Code Here

Examples of java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()

        c1.get().write("start");

        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();

        while (!messageCount.await(100, TimeUnit.MILLISECONDS)) {
            long[] threads = threadMXBean.findMonitorDeadlockedThreads();

            if (null != threads) {
                StringBuffer sb = new StringBuffer(256);
                ThreadInfo[] infos = threadMXBean.getThreadInfo(threads, Integer.MAX_VALUE);
View Full Code Here

Examples of java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()

        return dumper.toString();
    }

    public static String getDeadlockedThreads() {
        ThreadMXBean bean = ManagementFactory.getThreadMXBean();
        long[] deadlocked = bean.findMonitorDeadlockedThreads();
        if (deadlocked == null || deadlocked.length == 0) {
            return "";
        }

        String buf = "Deadlocked thread IDs: ";
View Full Code Here

Examples of java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()

            if (deadlockedThreads == null || deadlockedThreads.length == 0) {
                return null;
            }
            return threadMXBean.getThreadInfo(deadlockedThreads, true, true);
        } else {
            long[] monitorDeadlockedThreads = threadMXBean.findMonitorDeadlockedThreads();
            return getThreadInfos(threadMXBean, monitorDeadlockedThreads);
        }
    }

    public static ThreadInfo[] getAllThreads() {
View Full Code Here

Examples of java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()

        Map<String, Object> threadInfoMap = new HashMap<String, Object>(); // more to come ;)
        threadInfoMap.put("peak_thread_count", threadMXBean.getPeakThreadCount());
        threadInfoMap.put("thread_count", threadMXBean.getThreadCount());
        threadInfoMap.put("total_started_thread_count", threadMXBean.getTotalStartedThreadCount());

        long[] deadlockedThreads = threadMXBean.findMonitorDeadlockedThreads();
        threadInfoMap.put("dead_locked_thread_count", deadlockedThreads != null ? deadlockedThreads.length : 0);
        systemInfo.put("thread_info", threadInfoMap);


        JSONObject sysinfoJson = new JSONObject(Collections.singletonMap("system_info", systemInfo));
View Full Code Here

Examples of java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()

        // use jmx to do deadlock detection
        try {
            final ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
            while (ai.get() > 0) {
                long[] deadlockedThreads = mbean.findMonitorDeadlockedThreads();
                if (deadlockedThreads != null && deadlockedThreads.length > 0) {
                    fail("Deadlock detected between the following threads: "
                            + Arrays.toString(deadlockedThreads));
                }
                // sleep for a bit
View Full Code Here

Examples of java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()

        // use jmx to do deadlock detection
        try {
            final ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
            while (ai.get() > 0) {
                long[] deadlockedThreads = mbean.findMonitorDeadlockedThreads();
                if (deadlockedThreads != null && deadlockedThreads.length > 0) {
                    fail("Deadlock detected between the following threads: "
                            + Arrays.toString(deadlockedThreads));
                }
                // sleep for a bit
View Full Code Here

Examples of java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()

    // Check for thread deadlock and exit if it occurs.
    // TODO: Can we clean up the deadlocked threads?
    ThreadMXBean tmx = ManagementFactory.getThreadMXBean();
    while (thread1.isAlive() && thread2.isAlive()) {
      try { Thread.sleep(20); } catch (InterruptedException e) {}
      long[] ids = tmx.findMonitorDeadlockedThreads();
      if (ids != null) {
        ThreadInfo[] infos = tmx.getThreadInfo(ids);
        // TODO: Use logging instead?
        System.out.println("The following threads are deadlocked:");
        for (ThreadInfo ti : infos) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.