Examples of ThreadDeadlockDetector


Examples of com.codahale.metrics.jvm.ThreadDeadlockDetector

import static org.mockito.Mockito.when;

public class ThreadDeadlockHealthCheckTest {
    @Test
    public void isHealthyIfNoThreadsAreDeadlocked() throws Exception {
        final ThreadDeadlockDetector detector = mock(ThreadDeadlockDetector.class);
        final ThreadDeadlockHealthCheck healthCheck = new ThreadDeadlockHealthCheck(detector);

        when(detector.getDeadlockedThreads()).thenReturn(Collections.<String>emptySet());

        assertThat(healthCheck.execute().isHealthy())
                .isTrue();
    }
View Full Code Here

Examples of com.codahale.metrics.jvm.ThreadDeadlockDetector

    public void isUnhealthyIfThreadsAreDeadlocked() throws Exception {
        final Set<String> threads = new TreeSet<String>();
        threads.add("one");
        threads.add("two");

        final ThreadDeadlockDetector detector = mock(ThreadDeadlockDetector.class);
        final ThreadDeadlockHealthCheck healthCheck = new ThreadDeadlockHealthCheck(detector);

        when(detector.getDeadlockedThreads()).thenReturn(threads);

        final HealthCheck.Result result = healthCheck.execute();

        assertThat(result.isHealthy())
                .isFalse();
View Full Code Here

Examples of com.codahale.metrics.jvm.ThreadDeadlockDetector

    /**
     * Creates a new health check.
     */
    public ThreadDeadlockHealthCheck() {
        this(new ThreadDeadlockDetector());
    }
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.