@Override
public <T extends Response> T execute(Action<T> action) throws Exception {
RunnedBy runnedBy = action.getClass().getAnnotation(RunnedBy.class);
Class<? extends ActionRunner> clazz = runnedBy.value();
ActionRunner actionRunner = injector.getInstance(clazz);
User user = appEngineServices.getUserService().getCurrentUser();
String userNickname = "anonymous";
if (user != null) {
userNickname = user.getNickname();
}
String ipAddress = getThreadLocalRequest().getRemoteAddr();
String className = action.getClass().getSimpleName();
logger.info("User {} (ip: {}) executing action: {}", new Object[]{userNickname, ipAddress, className});
try {
return (T) actionRunner.execute(action);
} catch (Exception e) {
logger.error("Caught Exception", e);
throw new RpcException(e.getMessage());
}
}