Search in sources :

Example 1 with HashedBalanceRouter

use of com.generallycloud.baseio.balance.router.HashedBalanceRouter in project baseio by generallycloud.

the class TestBalanceMain method main.

public static void main(String[] args) throws IOException {
    BalanceServerBootStrap f = new BalanceServerBootStrap();
    f.setBalanceProtocolFactory(new ProtobaseProtocolFactory());
    f.setBalanceReverseProtocolFactory(new ProtobaseProtocolFactory());
    f.setBalanceProtocolFactory(new ProtobaseProtocolFactory());
    f.setBalanceReverseProtocolFactory(new ProtobaseProtocolFactory());
    ServerConfiguration fc = new ServerConfiguration();
    fc.setSERVER_PORT(8600);
    ServerConfiguration frc = new ServerConfiguration();
    frc.setSERVER_PORT(8800);
    f.setFacadeExceptionCaughtHandle(new LoggerExceptionCaughtHandle());
    f.setReverseExceptionCaughtHandle(new LoggerExceptionCaughtHandle());
    f.setBalanceServerConfiguration(fc);
    f.setBalanceReverseServerConfiguration(frc);
    f.setFacadeInterceptor(new FacadeInterceptorImpl(500, 50000));
    f.setBalanceRouter(new HashedBalanceRouter(10240));
    // f.setBalanceRouter(new SimpleNextRouter());
    f.startup();
}
Also used : ProtobaseProtocolFactory(com.generallycloud.baseio.codec.protobase.ProtobaseProtocolFactory) LoggerExceptionCaughtHandle(com.generallycloud.baseio.component.LoggerExceptionCaughtHandle) ServerConfiguration(com.generallycloud.baseio.configuration.ServerConfiguration) HashedBalanceRouter(com.generallycloud.baseio.balance.router.HashedBalanceRouter) FacadeInterceptorImpl(com.generallycloud.baseio.balance.FacadeInterceptorImpl) BalanceServerBootStrap(com.generallycloud.baseio.balance.BalanceServerBootStrap)

Aggregations

BalanceServerBootStrap (com.generallycloud.baseio.balance.BalanceServerBootStrap)1 FacadeInterceptorImpl (com.generallycloud.baseio.balance.FacadeInterceptorImpl)1 HashedBalanceRouter (com.generallycloud.baseio.balance.router.HashedBalanceRouter)1 ProtobaseProtocolFactory (com.generallycloud.baseio.codec.protobase.ProtobaseProtocolFactory)1 LoggerExceptionCaughtHandle (com.generallycloud.baseio.component.LoggerExceptionCaughtHandle)1 ServerConfiguration (com.generallycloud.baseio.configuration.ServerConfiguration)1