private void handleDiscoveryCheckInWithHealth(final AtomicLong lastCheckIn, final long checkInDuration) { final AtomicBoolean ok = new AtomicBoolean(true); httpServer.setHttpRequestsIdleConsumer(aVoid -> { httpRequestServerHandler.httpRequestQueueIdle(null); long now = Timer.clockTime(); if (now > lastCheckIn.get() + checkInDuration) { lastCheckIn.set(now); if (ok.get()) { serviceDiscovery.checkInOk(endpoint.getId()); } else { serviceDiscovery.checkIn(endpoint.getId(), HealthStatus.FAIL); } healthServiceAsync.ok(ok::set); ServiceProxyUtils.flushServiceProxy(healthServiceAsync); } }); }
public void handleCheckIn() { if (healthServiceAsync == null) { if (Timer.clockTime() - lastCheckIn.get() > checkInEveryMiliDuration) { lastCheckIn.set(Timer.clockTime()); serviceDiscovery.checkInOk(endpointDefinition.getId()); } } else { if (Timer.clockTime() - lastCheckIn.get() > checkInEveryMiliDuration) { lastCheckIn.set(Timer.clockTime()); healthServiceAsync.ok(ok::set); ServiceProxyUtils.flushServiceProxy(healthServiceAsync); if (ok.get()) { serviceDiscovery.checkInOk(endpointDefinition.getId()); } else { serviceDiscovery.checkIn(endpointDefinition.getId(), HealthStatus.FAIL); } ServiceProxyUtils.flushServiceProxy(serviceDiscovery); } } }
healthServiceAsync.ok(ok -> { if (ok) { httpRequest.getReceiver().respondOK("\"ok\"");
/** * Read annotation. * * @param responseCallback responseCallback */ @RequestMapping(value = "/ok", summary = "simple health check", description = "Health check. This returns true if all nodes (service actors) are healthy", returnDescription = "true if all nodes are healthy, false if all nodes are not healthy") public void ok(final Callback<HttpTextResponse> responseCallback) { healthService.ok(callbackBuilder().withBooleanCallback(ok -> { if (ok) { responseCallback.resolve(httpResponseBuilder().setBody("true").setCode(200).buildTextResponse()); } else { responseCallback.resolve(httpResponseBuilder().setBody("false").setCode(503).buildTextResponse()); } }).build()); healthService.clientProxyFlush(); }
private void handleDiscoveryCheckInWithHealth(final AtomicLong lastCheckIn, final long checkInDuration) { final AtomicBoolean ok = new AtomicBoolean(true); httpServer.setHttpRequestsIdleConsumer(aVoid -> { httpRequestServerHandler.httpRequestQueueIdle(null); long now = Timer.clockTime(); if (now > lastCheckIn.get() + checkInDuration) { lastCheckIn.set(now); if (ok.get()) { serviceDiscovery.checkInOk(endpoint.getId()); } else { serviceDiscovery.checkIn(endpoint.getId(), HealthStatus.FAIL); } healthServiceAsync.ok(ok::set); ServiceProxyUtils.flushServiceProxy(healthServiceAsync); } }); }
private void handleDiscoveryCheckInWithHealth(final AtomicLong lastCheckIn, final long checkInDuration) { final AtomicBoolean ok = new AtomicBoolean(true); httpServer.setHttpRequestsIdleConsumer(aVoid -> { httpRequestServerHandler.httpRequestQueueIdle(null); long now = Timer.clockTime(); if (now > lastCheckIn.get() + checkInDuration) { lastCheckIn.set(now); if (ok.get()) { serviceDiscovery.checkInOk(endpoint.getId()); } else { serviceDiscovery.checkIn(endpoint.getId(), HealthStatus.FAIL); } healthServiceAsync.ok(ok::set); ServiceProxyUtils.flushServiceProxy(healthServiceAsync); } }); } public void stop() {
public void handleCheckIn() { if (healthServiceAsync == null) { if (Timer.clockTime() - lastCheckIn.get() > checkInEveryMiliDuration) { lastCheckIn.set(Timer.clockTime()); serviceDiscovery.checkInOk(endpointDefinition.getId()); } } else { if (Timer.clockTime() - lastCheckIn.get() > checkInEveryMiliDuration) { lastCheckIn.set(Timer.clockTime()); healthServiceAsync.ok(ok::set); ServiceProxyUtils.flushServiceProxy(healthServiceAsync); if (ok.get()) { serviceDiscovery.checkInOk(endpointDefinition.getId()); } else { serviceDiscovery.checkIn(endpointDefinition.getId(), HealthStatus.FAIL); } ServiceProxyUtils.flushServiceProxy(serviceDiscovery); } } }
public void handleCheckIn() { if (healthServiceAsync == null) { if (Timer.clockTime() - lastCheckIn.get() > checkInEveryMiliDuration) { lastCheckIn.set(Timer.clockTime()); serviceDiscovery.checkInOk(endpointDefinition.getId()); } } else { if (Timer.clockTime() - lastCheckIn.get() > checkInEveryMiliDuration) { lastCheckIn.set(Timer.clockTime()); healthServiceAsync.ok(ok::set); ServiceProxyUtils.flushServiceProxy(healthServiceAsync); if (ok.get()) { serviceDiscovery.checkInOk(endpointDefinition.getId()); } else { serviceDiscovery.checkIn(endpointDefinition.getId(), HealthStatus.FAIL); } ServiceProxyUtils.flushServiceProxy(serviceDiscovery); } } }
healthServiceAsync.ok(ok -> { if (ok) { httpRequest.getReceiver().respondOK("\"ok\"");
healthServiceAsync.ok(ok -> { if (ok) { httpRequest.getReceiver().respondOK("\"ok\"");