try {
Future future = (Future) req.getMethod().invoke(this, req.getArgs());
if (future instanceof ResultFuture) {
req.getFuture().doComplete(future.get());
} else if (future instanceof TypedFuture) {
future.addListener(new FutureCallback() {
@Override
public void onResult(Object result) {
req.getFuture().doComplete(result);
}