use of com.tvd12.ezyfoxserver.event.EzyEvent in project ezyfox-server-android-client by youngmonkeys.
the class EzySocketClient method processEvents.
protected void processEvents() {
socketEventQueue.popAll(localEventQueue);
try {
for (int i = 0; i < localEventQueue.size(); ++i) {
EzyEvent evt = localEventQueue.get(i);
eventHandlers.handle(evt);
}
} finally {
localEventQueue.clear();
}
}
use of com.tvd12.ezyfoxserver.event.EzyEvent in project ezyfox-server by youngmonkeys.
the class EzyBroadcastPluginsEventImpl method fire.
@Override
public void fire(EzyConstant type, EzyEvent event, boolean catchException) {
logger.debug("zone: {} broadcast to plugins event: {}", getZoneName(), type);
Set<EzyPluginContext> pluginContexts = pluginContextMaps.get(type);
if (pluginContexts != null) {
for (EzyPluginContext pluginContext : pluginContexts) {
firePluginEvent(pluginContext, type, event, catchException);
}
}
}
use of com.tvd12.ezyfoxserver.event.EzyEvent in project ezyfox-server by youngmonkeys.
the class EzyServerBootstrap method doNotifyServerReady.
protected void doNotifyServerReady() {
EzyEvent event = new EzySimpleServerReadyEvent();
context.handleEvent(EzyEventType.SERVER_READY, event);
context.broadcast(EzyEventType.SERVER_READY, event, true);
}
use of com.tvd12.ezyfoxserver.event.EzyEvent in project ezyfox-server-android-client by youngmonkeys.
the class EzyEventHandlers method handle.
public void handle(EzyEvent event) {
EzyEventType eventType = event.getType();
EzyEventHandler handler = handlers.get(eventType);
if (handler != null)
handler.handle(event);
else
EzyLogger.warn("has no handler for event type: " + eventType);
}
use of com.tvd12.ezyfoxserver.event.EzyEvent in project ezyfox-server-android-client by youngmonkeys.
the class EzySocketClient method processStatuses.
protected void processStatuses() {
socketStatuses.popAll(localSocketStatuses);
for (int i = 0; i < localSocketStatuses.size(); ++i) {
EzySocketStatus status = localSocketStatuses.get(i);
if (status == EzySocketStatus.CONNECTED) {
EzyEvent evt = new EzyConnectionSuccessEvent();
socketEventQueue.addEvent(evt);
} else if (status == EzySocketStatus.CONNECT_FAILED) {
EzyEvent evt = new EzyConnectionFailureEvent(connectionFailedReason);
socketEventQueue.addEvent(evt);
break;
} else if (status == EzySocketStatus.DISCONNECTED) {
EzyEvent evt = new EzyDisconnectionEvent(disconnectReason);
socketEventQueue.addEvent(evt);
break;
}
}
localSocketStatuses.clear();
}
Aggregations