Package org.rioproject.impl.watch

Examples of org.rioproject.impl.watch.ThreadDeadlockMonitor


             */
            if(store != null)
                store.snapshot();

            MBeanServer mbs = MBeanServerFactory.getMBeanServer();
            final ThreadDeadlockMonitor threadDeadlockMonitor = new ThreadDeadlockMonitor();
            ThreadMXBean threadMXBean = JMXUtil.getPlatformMXBeanProxy(mbs,
                                                                       ManagementFactory.THREAD_MXBEAN_NAME,
                                                                       ThreadMXBean.class);
            threadDeadlockMonitor.setThreadMXBean(threadMXBean);
            PeriodicWatch p = new PeriodicWatch("Thread Deadlock", config) {
                public void checkValue() {
                    threadDeadlockMonitor.getThreadDeadlockCalculable();
                }
            };
            p.setPeriod(10*1000); // 10 seconds
            context.getWatchRegistry().register(p);
            p.start();
View Full Code Here


                    ClassLoader loader = impl.getClass().getClassLoader();
                    /* Load the SLA PolicyHandler and set attributes */
                    handler = createSLAPolicyHandler(sla, loader);
                    Method getThreadDeadlockCalculable =
                        ThreadDeadlockMonitor.class.getMethod("getThreadDeadlockCalculable");
                    ThreadDeadlockMonitor threadDeadlockMonitor = new ThreadDeadlockMonitor();
                    if(wDesc.getMBeanServerConnection()!=null) {
                        ThreadMXBean threadMXBean =
                            JMXUtil.getPlatformMXBeanProxy(wDesc.getMBeanServerConnection(),
                                                           ManagementFactory.THREAD_MXBEAN_NAME,
                                                           ThreadMXBean.class);
                        threadDeadlockMonitor.setThreadMXBean(threadMXBean);
                    }
                    watchInjector.inject(wDesc, threadDeadlockMonitor, getThreadDeadlockCalculable);

                } catch (Exception e) {
                    logger.warn("Creating SLAPolicyHandler for SLA [{}]", sla.getIdentifier(), e);
View Full Code Here

        if(threadDeadlockCheck>=1000) {

            WatchDescriptor threadDeadlockDescriptor = ThreadDeadlockMonitor.getWatchDescriptor();
            threadDeadlockDescriptor.setPeriod(threadDeadlockCheck);
            Method getThreadDeadlockCalculable = ThreadDeadlockMonitor.class.getMethod("getThreadDeadlockCalculable");
            ThreadDeadlockMonitor threadDeadlockMonitor = new ThreadDeadlockMonitor();
            threadDeadlockMonitor.setThreadMXBean(ManagementFactory.getThreadMXBean());

            WatchInjector watchInjector = new WatchInjector(this, context);
            ThresholdWatch watch = (ThresholdWatch)watchInjector.inject(threadDeadlockDescriptor,
                                                                        threadDeadlockMonitor,
                                                                        getThreadDeadlockCalculable);
View Full Code Here

TOP

Related Classes of org.rioproject.impl.watch.ThreadDeadlockMonitor

Copyright © 2018 www.massapicom. 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.