Skip to content

Commit

Permalink
Add async variant to the pinger.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Negrea committed Apr 1, 2015
1 parent 976d46e commit 76254cc
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -25,6 +25,8 @@
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Response;

import org.hawkular.metrics.api.jaxrs.util.StringValue;
Expand All @@ -46,4 +48,13 @@ public class PingHandler {
public Response ping() {
return Response.ok(new StringValue(new Date().toString())).build();
}

@GET
@POST
@Path("/async")
@ApiOperation(value = "Async ping variant", response = String.class, responseContainer = "Map")
public void createNumericMetric(@Suspended final AsyncResponse asyncResponse) {
Response response = Response.ok(new StringValue(new Date().toString())).build();
asyncResponse.resume(response);
}
}

0 comments on commit 76254cc

Please sign in to comment.