Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.core.web; |
| 2 | |
| 3 | import org.restlet.resource.Get; |
| 4 | import org.restlet.resource.ServerResource; |
| 5 | |
| 6 | public class HealthCheckResource extends ServerResource { |
| 7 | |
| 8 | public static class HealthCheckInfo { |
| 9 | |
| 10 | protected boolean healthy; |
| 11 | |
| 12 | public HealthCheckInfo() { |
| 13 | this.healthy = true; |
| 14 | } |
| 15 | |
| 16 | public boolean isHealthy() { |
| 17 | return healthy; |
| 18 | } |
| 19 | |
| 20 | public void setHealthy(boolean healthy) { |
| 21 | this.healthy = healthy; |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | @Get("json") |
| 26 | public HealthCheckInfo healthCheck() { |
| 27 | // Currently this is the simplest possible health check -- basically |
| 28 | // just that the controller is still running and able to respond to |
| 29 | // REST calls. |
| 30 | // Eventually this should be more sophisticated and do things |
| 31 | // like monitoring internal data structures of the controller |
| 32 | // (e.g. async storage queue length). |
| 33 | return new HealthCheckInfo(); |
| 34 | } |
| 35 | |
| 36 | } |