/** * Returns the current {@link org.fishwife.jrugged.Status} of the * {@link CircuitBreaker}. In this case, it really refers to the * status of the client service. If the * <code>CircuitBreaker</code> is CLOSED, we report that the * client is UP; if it is HALF_CLOSED, we report that the client * is DEGRADED; if it is OPEN, we report the client is DOWN. * * @return Status the current status of the breaker */ public Status getStatus() { return getServiceStatus().getStatus(); }
/** * Get the current {@link ServiceStatus} of the * {@link CircuitBreaker}, including the name, * {@link org.fishwife.jrugged.Status}, and reason. * @return the {@link ServiceStatus}. */ public ServiceStatus getServiceStatus() { boolean canSendProbeRequest = !isHardTrip && lastFailure.get() > 0 && allowRequest(); if (byPass) { return new ServiceStatus(name, Status.DEGRADED, "Bypassed"); } switch(state) { case OPEN: return (canSendProbeRequest ? new ServiceStatus(name, Status.DEGRADED, "Send Probe Request") : new ServiceStatus(name, Status.DOWN, "Open")); case HALF_CLOSED: return new ServiceStatus(name, Status.DEGRADED, "Half Closed"); case CLOSED: default: return new ServiceStatus(name, Status.UP); } }
Status status = serviceStatus.getStatus(); for (String reason : serviceStatus.getReasons()) { reasons.add(serviceStatus.getName() + ":" + reason); Status status = serviceStatus.getStatus(); for (String reason : serviceStatus.getReasons()) { reasons.add(serviceStatus.getName() + ":" + reason); return new ServiceStatus(name, result, reasons);
public ModelAndView handleRequest(HttpServletRequest req, HttpServletResponse resp) throws Exception { Status currentStatus = monitoredService.getServiceStatus().getStatus(); setResponseCode(currentStatus, resp); setAppropriateWarningHeaders(resp, currentStatus); setCachingHeaders(resp); writeOutCurrentStatusInResponseBody(resp, currentStatus); return null; }