use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.
the class EzySimpleDataHandler method handleRequest.
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void handleRequest(EzyConstant cmd, EzyArray data) {
try {
EzyRequest request = newRequest(cmd, data);
try {
EzyInterceptor interceptor = controllers.getInterceptor(cmd);
interceptor.intercept(context, request);
EzyController controller = controllers.getController(cmd);
controller.handle(context, request);
} finally {
request.release();
}
} catch (Exception e) {
if (context != null) {
Throwable throwable = requestHandleException(session, cmd, data, e);
context.handleException(Thread.currentThread(), throwable);
} else {
if (active) {
logger.warn("fatal error, please add an issue to ezyfox-server github " + "with log: {}\nand stacktrace: ", this, e);
} else {
logger.warn("can't handle command: {} and data: {}, this session " + "maybe destroyed (session: {}), error message: {}", cmd, data, session, e.getMessage());
}
}
}
}
use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.
the class EzySimpleDataHandler method notifySessionRemoved.
protected void notifySessionRemoved(EzyConstant reason) {
if (zoneContext != null) {
EzyEvent event = newSessionRemovedEvent(reason);
notifyAppsSessionRemoved(event);
notifyPluginsSessionRemoved(event);
}
}
use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.
the class EzySimpleAppUserDelegate method handleUserRemovedEvent.
protected void handleUserRemovedEvent(EzyUser user, EzyConstant reason) {
EzyEvent event = new EzySimpleUserRemovedEvent(user, reason);
appContext.handleEvent(EzyEventType.USER_REMOVED, event);
}
use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.
the class EzySimpleUserDelegate method onUserRemoved.
@Override
public void onUserRemoved(EzyUser user, EzyConstant reason) {
EzyZoneContext zoneContext = serverContext.getZoneContext(user.getZoneId());
EzySocketUserRemoval removal = new EzySimpleSocketUserRemoval(zoneContext, user, reason);
userRemovalQueue.add(removal);
}
use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.
the class EzyBroadcastPluginsEventImpl method getPluginContextMaps.
private EzyMapSet<EzyConstant, EzyPluginContext> getPluginContextMaps() {
Collection<EzyPluginContext> pluginContexts = context.getPluginContexts();
EzyMapSet<EzyConstant, EzyPluginContext> pluginContextMaps = new EzyHashMapSet<>();
for (EzyPluginContext pluginContext : pluginContexts) {
EzyPluginSetting pluginSetting = pluginContext.getPlugin().getSetting();
Set<EzyConstant> listenEvents = pluginSetting.getListenEvents().getEvents();
for (EzyConstant listenEvent : listenEvents) {
pluginContextMaps.addItem(listenEvent, pluginContext);
}
}
return pluginContextMaps;
}
Aggregations