Search in sources :

Example 16 with EzyConstant

use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.

the class EzySimpleDataHandler method handleReceivedData.

protected void handleReceivedData(EzyConstant cmd, EzyArray msg) {
    EzyArray data = msg.get(1, EzyArray.class);
    debugLogReceivedData(cmd, data);
    updateSessionBeforeHandleRequest();
    handleRequest(cmd, data);
}
Also used : EzyArray(com.tvd12.ezyfox.entity.EzyArray)

Example 17 with EzyConstant

use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.

the class EzyUserDataHandler method newRequest.

@SuppressWarnings({ "rawtypes" })
protected EzyRequest newRequest(EzyConstant cmd, EzyArray data) {
    EzySimpleRequest request = requestFactory.newRequest(cmd);
    request.setSession(session);
    request.setUser(user);
    request.deserializeParams(data);
    return request;
}
Also used : EzySimpleRequest(com.tvd12.ezyfoxserver.request.EzySimpleRequest)

Example 18 with EzyConstant

use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.

the class EzyZoneUserManagerImpl method unmapSessionUser.

@Override
public void unmapSessionUser(EzySession session, EzyConstant reason) {
    EzyUser user = usersBySession.remove(session);
    if (user != null) {
        user.removeSession(session);
        logger.debug("zone: {} remove session {} from user {} by reason {}, " + "user remain: {} sessions, usersBySession.size: {}", zoneName, session.getClientAddress(), user, reason, user.getSessionCount(), usersBySession.size());
        if (shouldRemoveUserNow(user)) {
            removeUser(user, reason);
        }
    }
}
Also used : EzyUser(com.tvd12.ezyfoxserver.entity.EzyUser)

Example 19 with EzyConstant

use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.

the class EzySocketUserRemovalHandler method processUserRemoval.

private void processUserRemoval(EzySocketUserRemoval removal) {
    try {
        EzyUser user = removal.getUser();
        try {
            EzyConstant reason = removal.getReason();
            EzyZoneContext zoneContext = removal.getZoneContext();
            EzyUserRemovedEvent event = newUserRemovedEvent(user, reason);
            removeUserFromApps(zoneContext, event);
            notifyUserRemovedToPlugins(zoneContext, event);
        } finally {
            user.destroy();
        }
        logger.debug("user {} has destroyed", user);
    } finally {
        removal.release();
    }
}
Also used : EzyUser(com.tvd12.ezyfoxserver.entity.EzyUser) EzyZoneContext(com.tvd12.ezyfoxserver.context.EzyZoneContext) EzyConstant(com.tvd12.ezyfox.constant.EzyConstant) EzyUserRemovedEvent(com.tvd12.ezyfoxserver.event.EzyUserRemovedEvent)

Aggregations

EzyConstant (com.tvd12.ezyfox.constant.EzyConstant)6 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)4 EzyZoneContext (com.tvd12.ezyfoxserver.context.EzyZoneContext)3 EzyPluginContext (com.tvd12.ezyfoxserver.context.EzyPluginContext)2 EzyUser (com.tvd12.ezyfoxserver.entity.EzyUser)2 EzyEvent (com.tvd12.ezyfoxserver.event.EzyEvent)2 EzyResponse (com.tvd12.ezyfoxserver.response.EzyResponse)2 EzyArray (com.tvd12.ezyfox.entity.EzyArray)1 EzyHashMapSet (com.tvd12.ezyfox.util.EzyHashMapSet)1 EzyController (com.tvd12.ezyfoxserver.controller.EzyController)1 EzyAbstractSession (com.tvd12.ezyfoxserver.entity.EzyAbstractSession)1 EzySimpleUserRemovedEvent (com.tvd12.ezyfoxserver.event.EzySimpleUserRemovedEvent)1 EzyUserRemovedEvent (com.tvd12.ezyfoxserver.event.EzyUserRemovedEvent)1 EzyRequestHandleException.requestHandleException (com.tvd12.ezyfoxserver.exception.EzyRequestHandleException.requestHandleException)1 EzyInterceptor (com.tvd12.ezyfoxserver.interceptor.EzyInterceptor)1 EzyRequest (com.tvd12.ezyfoxserver.request.EzyRequest)1 EzySimpleRequest (com.tvd12.ezyfoxserver.request.EzySimpleRequest)1 EzyDisconnectParams (com.tvd12.ezyfoxserver.response.EzyDisconnectParams)1 EzyDisconnectResponse (com.tvd12.ezyfoxserver.response.EzyDisconnectResponse)1 EzyExitedAppParams (com.tvd12.ezyfoxserver.response.EzyExitedAppParams)1