Search in sources :

Example 1 with FutureAcceptorServiceFilter

use of com.generallycloud.baseio.container.service.FutureAcceptorServiceFilter in project baseio by generallycloud.

the class ApplicationContext method doStart.

@Override
protected void doStart() throws Exception {
    if (channelContext == null) {
        throw new IllegalArgumentException("null nio context");
    }
    if (StringUtil.isNullOrBlank(rootLocalAddress)) {
        throw new IllegalArgumentException("rootLocalAddress");
    }
    if (futureAcceptorServiceFilter == null) {
        this.futureAcceptorServiceFilter = new FutureAcceptorServiceFilter();
    }
    if (appRedeployService == null) {
        appRedeployService = new SystemRedeployServlet();
    }
    if (acLoader == null) {
        acLoader = new FileSystemACLoader();
    }
    if (exceptionCaughtHandle == null) {
        exceptionCaughtHandle = new LoggerExceptionCaughtHandle();
    }
    if (ioExceptionCaughtHandle == null) {
        ioExceptionCaughtHandle = new LoggerExceptionCaughtHandle();
    }
    instance = this;
    this.rootLocalAddress = FileUtil.getPrettyPath(rootLocalAddress);
    this.encoding = channelContext.getEncoding();
    this.appLocalAddres = FileUtil.getPrettyPath(getRootLocalAddress() + "app");
    LoggerUtil.prettyLog(logger, "application path      :{ {} }", appLocalAddres);
    this.initializeApplicationContext();
}
Also used : SystemRedeployServlet(com.generallycloud.baseio.container.implementation.SystemRedeployServlet) FileSystemACLoader(com.generallycloud.baseio.container.configuration.FileSystemACLoader) FutureAcceptorServiceFilter(com.generallycloud.baseio.container.service.FutureAcceptorServiceFilter) LoggerExceptionCaughtHandle(com.generallycloud.baseio.component.LoggerExceptionCaughtHandle)

Example 2 with FutureAcceptorServiceFilter

use of com.generallycloud.baseio.container.service.FutureAcceptorServiceFilter in project baseio by generallycloud.

the class ProtobaseApplicationContextEnricher method enrich.

@Override
public void enrich(ApplicationContext context) {
    SocketChannelContext channelContext = context.getChannelContext();
    context.setServiceFilter(new FutureAcceptorServiceFilter());
    // FIXME 重复的
    Set<String> blackIPs = context.getBlackIPs();
    if (blackIPs != null && !blackIPs.isEmpty()) {
        channelContext.addSessionEventListener(new BlackIPFilter(blackIPs));
    }
    channelContext.addSessionEventListener(new LoggerSocketSEListener());
    channelContext.setProtocolFactory(new ParamedProtobaseProtocolFactory());
    channelContext.setBeatFutureFactory(new ParamedProtobaseBeatFutureFactory());
}
Also used : LoggerSocketSEListener(com.generallycloud.baseio.component.LoggerSocketSEListener) FutureAcceptorServiceFilter(com.generallycloud.baseio.container.service.FutureAcceptorServiceFilter) BlackIPFilter(com.generallycloud.baseio.container.BlackIPFilter) SocketChannelContext(com.generallycloud.baseio.component.SocketChannelContext) ParamedProtobaseProtocolFactory(com.generallycloud.baseio.codec.protobase.ParamedProtobaseProtocolFactory) ParamedProtobaseBeatFutureFactory(com.generallycloud.baseio.codec.protobase.future.ParamedProtobaseBeatFutureFactory)

Aggregations

FutureAcceptorServiceFilter (com.generallycloud.baseio.container.service.FutureAcceptorServiceFilter)2 ParamedProtobaseProtocolFactory (com.generallycloud.baseio.codec.protobase.ParamedProtobaseProtocolFactory)1 ParamedProtobaseBeatFutureFactory (com.generallycloud.baseio.codec.protobase.future.ParamedProtobaseBeatFutureFactory)1 LoggerExceptionCaughtHandle (com.generallycloud.baseio.component.LoggerExceptionCaughtHandle)1 LoggerSocketSEListener (com.generallycloud.baseio.component.LoggerSocketSEListener)1 SocketChannelContext (com.generallycloud.baseio.component.SocketChannelContext)1 BlackIPFilter (com.generallycloud.baseio.container.BlackIPFilter)1 FileSystemACLoader (com.generallycloud.baseio.container.configuration.FileSystemACLoader)1 SystemRedeployServlet (com.generallycloud.baseio.container.implementation.SystemRedeployServlet)1