Skip to content

Instantly share code, notes, and snippets.

@gmucha
Created May 5, 2016 17:17
Show Gist options
  • Save gmucha/f96600fcfae2f5c5501f0699ade0a838 to your computer and use it in GitHub Desktop.
Save gmucha/f96600fcfae2f5c5501f0699ade0a838 to your computer and use it in GitHub Desktop.
@Override
public void addCallback(KairosTableRow<C, V, K> tableRow, FutureCallback<ResultSet> callback)
{
bufferCounter.incrementAndGet();
executorService.submit(() -> {
bufferCounter.decrementAndGet();
baseKairosTableRepository.addCallback(tableRow, new FutureCallback<ResultSet>()
{
@Override
public void onSuccess(@Nullable ResultSet result)
{
callback.onSuccess(result);
}
@Override
public void onFailure(Throwable t)
{
if (t instanceof InvalidQueryException) {
LOG.error("Invalid query, skipping.", t);
} else {
addCallback(tableRow, callback);
}
callback.onFailure(t);
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment