Skip to content

Instantly share code, notes, and snippets.

@jsanda
Created May 30, 2014 16:01
Show Gist options
  • Save jsanda/f671e94ae41ec0d31c67 to your computer and use it in GitHub Desktop.
Save jsanda/f671e94ae41ec0d31c67 to your computer and use it in GitHub Desktop.
private void addData(final AsyncResponse asyncResponse, Set<RawNumericMetric> rawData) {
ListenableFuture<Map<RawNumericMetric,Throwable>> future = metricsService.addData(rawData);
Futures.addCallback(future, new FutureCallback<Map<RawNumericMetric, Throwable>>() {
@Override
public void onSuccess(Map<RawNumericMetric, Throwable> errors) {
Response jaxrs = Response.ok().type(MediaType.APPLICATION_JSON_TYPE).build();
asyncResponse.resume(jaxrs);
}
@Override
public void onFailure(Throwable t) {
asyncResponse.resume(t);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment