@Test void noDeadlockDetected() { Mockito.when(threadBean.findDeadlockedThreads()).thenReturn(null); DeadlockHealthCheck check = new DeadlockHealthCheck(threadBean); HealthCheckResponse response = check.call(); MatcherAssert.assertThat(HealthCheckResponse.State.UP, is(response.getState())); MatcherAssert.assertThat(response.getData().isPresent(), is(false)); }
@Override public HealthCheckResponse call() { if (disabled) { LOGGER.log(Level.FINEST, "Running in graal native image, this health-check always returns up."); return HealthCheckResponse.builder() .name(NAME) .withData("enabled", "false") .withData("description", "in native image") .up() .build(); } boolean noDeadLock = false; try { noDeadLock = (threadBean.findDeadlockedThreads() == null); } catch (Throwable e) { LOGGER.log(Level.FINEST, "Failed to find deadlocks in ThreadMXBean, ignoring this healthcheck", e); } return HealthCheckResponse.named(NAME) .state(noDeadLock) .build(); }
DeadlockHealthCheck implements HealthCheck { @Override public HealthCheckResponse call() { if (disabled) { LOGGER.log(Level.FINEST, "Running in graal native image, this health-check always returns up."); return HealthCheckResponse.builder() .name(NAME) .withData("enabled", "false") .withData("description", "in native image") .up() .build(); } boolean noDeadLock = false; try { noDeadLock = (threadBean.findDeadlockedThreads() == null); } catch (Throwable e) { LOGGER.log(Level.FINEST, "Failed to find deadlocks in ThreadMXBean, ignoring this healthcheck", e); } return HealthCheckResponse.named(NAME) .state(noDeadLock) .build(); } }
DeadlockHealthCheck implements HealthCheck { @Override public HealthCheckResponse call() { if (disabled) { LOGGER.log(Level.FINEST, "Running in graal native image, this health-check always returns up."); return HealthCheckResponse.builder() .name(NAME) .withData("enabled", "false") .withData("description", "in native image") .up() .build(); } boolean noDeadLock = false; try { noDeadLock = (threadBean.findDeadlockedThreads() == null); } catch (Throwable e) { LOGGER.log(Level.FINEST, "Failed to find deadlocks in ThreadMXBean, ignoring this healthcheck", e); } return HealthCheckResponse.named(NAME) .state(noDeadLock) .build(); } @Inject  DeadlockHealthCheck(ThreadMXBean threadBean); }
DeadlockHealthCheck implements HealthCheck { @Override public HealthCheckResponse call() { if (disabled) { LOGGER.log(Level.FINEST, "Running in graal native image, this health-check always returns up."); return HealthCheckResponse.builder() .name(NAME) .withData("enabled", "false") .withData("description", "in native image") .up() .build(); } boolean noDeadLock = false; try { noDeadLock = (threadBean.findDeadlockedThreads() == null); } catch (Throwable e) { LOGGER.log(Level.FINEST, "Failed to find deadlocks in ThreadMXBean, ignoring this healthcheck", e); } return HealthCheckResponse.named(NAME) .state(noDeadLock) .build(); } @Inject  DeadlockHealthCheck(ThreadMXBean threadBean); static DeadlockHealthCheck create(ThreadMXBean threadBean); @Override HealthCheckResponse call(); }
DeadlockHealthCheck implements HealthCheck { @Override public HealthCheckResponse call() { if (disabled) { LOGGER.log(Level.FINEST, "Running in graal native image, this health-check always returns up."); return HealthCheckResponse.builder() .name(NAME) .withData("enabled", "false") .withData("description", "in native image") .up() .build(); } boolean noDeadLock = false; try { noDeadLock = (threadBean.findDeadlockedThreads() == null); } catch (Throwable e) { LOGGER.log(Level.FINEST, "Failed to find deadlocks in ThreadMXBean, ignoring this healthcheck", e); } return HealthCheckResponse.named(NAME) .state(noDeadLock) .build(); } @Inject  DeadlockHealthCheck(ThreadMXBean threadBean); static DeadlockHealthCheck create(ThreadMXBean threadBean); @Override HealthCheckResponse call();  }