Search in sources :

Example 1 with ClusterStatusTask

use of com.netflix.exhibitor.core.automanage.ClusterStatusTask in project exhibitor by soabase.

the class ClusterResource method getClusterStatus.

@Path("status")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getClusterStatus() throws Exception {
    InstanceConfig config = context.getExhibitor().getConfigManager().getConfig();
    ServerList serverList = new ServerList(config.getString(StringConfigs.SERVERS_SPEC));
    ClusterStatusTask task = new ClusterStatusTask(context.getExhibitor(), serverList.getSpecs());
    List<ServerStatus> statuses = context.getExhibitor().getForkJoinPool().invoke(task);
    GenericEntity<List<ServerStatus>> entity = new GenericEntity<List<ServerStatus>>(statuses) {
    };
    return Response.ok(entity).build();
}
Also used : InstanceConfig(com.netflix.exhibitor.core.config.InstanceConfig) GenericEntity(javax.ws.rs.core.GenericEntity) ServerStatus(com.netflix.exhibitor.core.entities.ServerStatus) ServerList(com.netflix.exhibitor.core.state.ServerList) ServerList(com.netflix.exhibitor.core.state.ServerList) List(java.util.List) ClusterStatusTask(com.netflix.exhibitor.core.automanage.ClusterStatusTask) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

ClusterStatusTask (com.netflix.exhibitor.core.automanage.ClusterStatusTask)1 InstanceConfig (com.netflix.exhibitor.core.config.InstanceConfig)1 ServerStatus (com.netflix.exhibitor.core.entities.ServerStatus)1 ServerList (com.netflix.exhibitor.core.state.ServerList)1 List (java.util.List)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 GenericEntity (javax.ws.rs.core.GenericEntity)1