latencySimulator.simulateLatency(clock.getCurrentTime() - start, service, request);
}
}
}
} catch (IllegalAccessException e) {
throw new UnknownException(packageName, methodName, e);
} catch (InstantiationException e) {
throw new UnknownException(packageName, methodName, e);
} catch (NoSuchMethodException e) {
throw new UnknownException(packageName, methodName, e);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof RuntimeException) {
throw (RuntimeException) e.getCause();
}
throw new UnknownException(packageName, methodName, e.getCause());
} finally {
ApiProxy.clearEnvironmentForCurrentThread();
}
}