link.jfire.socket.socketserver.bus.CenterSwitch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jfire-socket Show documentation
Show all versions of jfire-socket Show documentation
Jfire - socket is a server-side framework based on AIO. Users only need a simple implementation of a business logic processing interface can be the business data processing. The framework provides the client and server at the same time. Have strong connection capacity. Single server provides tens of thousands of connections.
The newest version!
package link.jfire.socket.socketserver.bus;
import javax.annotation.Resource;
import link.jfire.baseutil.simplelog.ConsoleLogFactory;
import link.jfire.baseutil.simplelog.Logger;
import link.jfire.socket.socketserver.handler.MessageHandler;
import link.jfire.socket.socketserver.interceptor.MessageInterceptor;
@Resource
public class CenterSwitch
{
@Resource
private MessageHandlerCenter handlerCenter;
private Logger logger = ConsoleLogFactory.getLogger();
private Thread requestThread;
public void init()
{
logger.debug("加载请求报文处理模块:{}", handlerCenter.getClass().getName());
logger.debug("加载的消息处理器有:");
for (MessageHandler handler : handlerCenter.getHandlerList())
{
logger.debug("{}", handler.getClass().getName());
}
logger.debug("加载的消息拦截器有:");
for (MessageInterceptor interceptor : handlerCenter.getInterceptorList())
{
logger.debug("{}", interceptor.getClass().getName());
}
handlerCenter.init();
requestThread = new Thread(handlerCenter, "任务处理中心线程");
requestThread.start();
}
public void stop() throws InterruptedException
{
requestThread.interrupt();
handlerCenter.stop();
}
}