use of com.generallycloud.baseio.balance.facade.BalanceFacadeSocketSessionFactory in project baseio by generallycloud.
the class BalanceServerBootStrap method startup.
public void startup() throws IOException {
if (balanceRouter == null) {
balanceRouter = new SimpleNextRouter();
}
if (facadeInterceptor == null) {
facadeInterceptor = new FacadeInterceptorImpl(5, 50000);
}
if (balanceReverseLogger == null) {
balanceReverseLogger = new BalanceReverseLogger();
}
if (noneLoadReadFutureAcceptor == null) {
noneLoadReadFutureAcceptor = new DefaultNoneLoadFutureAcceptor();
}
if (facadeExceptionCaughtHandle == null) {
facadeExceptionCaughtHandle = new SilentExceptionCaughtHandle();
}
if (reverseExceptionCaughtHandle == null) {
reverseExceptionCaughtHandle = new SilentExceptionCaughtHandle();
}
BalanceContext balanceContext = new BalanceContext();
balanceContext.setChannelLostReadFutureFactory(channelLostReadFutureFactory);
balanceContext.setNoneLoadReadFutureAcceptor(noneLoadReadFutureAcceptor);
balanceContext.setReverseExceptionCaughtHandle(reverseExceptionCaughtHandle);
balanceContext.setFacadeExceptionCaughtHandle(facadeExceptionCaughtHandle);
balanceContext.setBalanceReverseLogger(balanceReverseLogger);
balanceContext.setFacadeInterceptor(facadeInterceptor);
balanceContext.setBalanceRouter(balanceRouter);
if (balanceFacadeAcceptorHandler == null) {
balanceFacadeAcceptorHandler = new SessionIdBalanceFacadeAcceptorHandler(balanceContext);
}
balanceContext.setBalanceFacadeAcceptorHandler(balanceFacadeAcceptorHandler);
balanceContext.initialize();
balanceFacadeAcceptor = balanceContext.getBalanceFacadeAcceptor();
SocketChannelContext balanceChannelContext = getBalanceChannelContext(balanceContext, balanceServerConfiguration, balanceProtocolFactory);
balanceChannelContext.setSocketSessionFactory(new BalanceFacadeSocketSessionFactory());
SocketChannelContext balanceReverseChannelContext = getBalanceReverseChannelContext(balanceContext, balanceReverseServerConfiguration, balanceReverseProtocolFactory);
balanceReverseChannelContext.setSocketSessionFactory(new BalanceReverseSocketSessionFactory());
balanceFacadeAcceptor.start(balanceContext, balanceChannelContext, balanceReverseChannelContext);
}
Aggregations