Search in sources :

Example 36 with EzyChannel

use of com.tvd12.ezyfoxserver.socket.EzyChannel in project ezyfox-server by youngmonkeys.

the class EzyHandlerGroupManagerImpl method newHandlerGroup.

@SuppressWarnings("unchecked")
@Override
public <T extends EzyHandlerGroup> T newHandlerGroup(EzyChannel channel, EzyConnectionType type) {
    EzyHandlerGroup group = handlerGroupBuilderFactory.newBuilder(channel, type).build();
    groupsByConnection.put(channel.getConnection(), group);
    return (T) group;
}
Also used : EzyHandlerGroup(com.tvd12.ezyfoxserver.nio.handler.EzyHandlerGroup)

Example 37 with EzyChannel

use of com.tvd12.ezyfoxserver.socket.EzyChannel in project ezyfox-server by youngmonkeys.

the class EzyHandlerGroupManagerImpl method getHandlerGroup.

private EzyHandlerGroup getHandlerGroup(EzySession session) {
    if (session == null) {
        return null;
    }
    EzyChannel channel = session.getChannel();
    if (channel == null) {
        return null;
    }
    Object connection = channel.getConnection();
    if (connection == null) {
        return null;
    }
    return groupsByConnection.get(connection);
}
Also used : EzyChannel(com.tvd12.ezyfoxserver.socket.EzyChannel)

Example 38 with EzyChannel

use of com.tvd12.ezyfoxserver.socket.EzyChannel in project ezyfox-server by youngmonkeys.

the class EzyHandlerGroupManagerImpl method removeHandlerGroup.

@Override
public EzySocketDataHandlerGroup removeHandlerGroup(EzySession session) {
    if (session == null) {
        return null;
    }
    EzyChannel channel = session.getChannel();
    if (channel == null) {
        return null;
    }
    Object connection = channel.getConnection();
    if (connection == null) {
        return null;
    }
    EzyHandlerGroup group = groupsByConnection.remove(connection);
    SocketAddress udpClientAddress = session.getUdpClientAddress();
    if (udpClientAddress != null) {
        socketChannelByUdpAddress.remove(udpClientAddress);
    }
    logger.debug("remove handler group: {} with session: {}, " + "groupsByConnection.size: {}, socketChannelByUdpAddress.size: {}", group, session, groupsByConnection.size(), socketChannelByUdpAddress.size());
    return group;
}
Also used : EzyChannel(com.tvd12.ezyfoxserver.socket.EzyChannel) SocketAddress(java.net.SocketAddress) EzyHandlerGroup(com.tvd12.ezyfoxserver.nio.handler.EzyHandlerGroup)

Aggregations

Test (org.testng.annotations.Test)26 EzyChannel (com.tvd12.ezyfoxserver.socket.EzyChannel)21 EzySessionManager (com.tvd12.ezyfoxserver.wrapper.EzySessionManager)19 EzyAbstractSession (com.tvd12.ezyfoxserver.entity.EzyAbstractSession)16 BaseTest (com.tvd12.test.base.BaseTest)14 EzySimpleServer (com.tvd12.ezyfoxserver.EzySimpleServer)12 EzyServerContext (com.tvd12.ezyfoxserver.context.EzyServerContext)12 EzySimpleServerContext (com.tvd12.ezyfoxserver.context.EzySimpleServerContext)12 EzySimpleSessionTokenGenerator (com.tvd12.ezyfoxserver.service.impl.EzySimpleSessionTokenGenerator)12 EzySimpleSettings (com.tvd12.ezyfoxserver.setting.EzySimpleSettings)12 EzyServerControllers (com.tvd12.ezyfoxserver.wrapper.EzyServerControllers)12 EzyController (com.tvd12.ezyfoxserver.controller.EzyController)11 EzyStreamingController (com.tvd12.ezyfoxserver.controller.EzyStreamingController)11 EzyInterceptor (com.tvd12.ezyfoxserver.interceptor.EzyInterceptor)11 EzySimpleStreamingSetting (com.tvd12.ezyfoxserver.setting.EzySimpleStreamingSetting)11 EzySimpleStatistics (com.tvd12.ezyfoxserver.statistics.EzySimpleStatistics)11 EzyStatistics (com.tvd12.ezyfoxserver.statistics.EzyStatistics)11 ExecutorService (java.util.concurrent.ExecutorService)11 EzyServer (com.tvd12.ezyfoxserver.EzyServer)10 EzyZone (com.tvd12.ezyfoxserver.EzyZone)10