?????????????????????????????mina???д????????????mina2.0?????????????mina?????????????????

???????mina????

????????????Apache??Mina??Multipurpose Infrastructure Networked Applications???????????????????????????????????????????????????ó?????????????????????????????API???Java NIO????????Э?饗??TCP/IP??UDP/IPЭ??????????Ч??????

?????????????http://mina.apache.org/

????????????http://my.oschina.net/ielts0909/blog/90355/

????????mina?????????

??????????????????mina????????????????????????????????????IoProcessor??????????????????????????????????????IoSession?????IoFilter???????????????IoHandler?????????????????

???????????????

????1??IoService

????IoService???????????????????????????????????????????????

??????????????????????

try {
  acceptor = new NioSocketAcceptor();\????????????
  acceptor.getFilterChain().addLast(  "codec"??  new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("UTF-8")??  LineDelimiter.WINDOWS.getValue()??  LineDelimiter.WINDOWS.getValue()))); \???????????
  acceptor.getFilterChain().addLast("logger"??new LoggingFilter()); \??????????????
  acceptor.getSessionConfig().setReadBufferSize(2048);\?????????????С
  acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE?? 10);\?????д???н??????
  acceptor.setHandler(new IoHandlerAdapter());\???????????
  acceptor.bind(new InetSocketAddress(port));\?????
  logger.info("???????????... ???????" + port);
} catch (Exception e) {
  logger.error("??????????...."?? e);
  e.printStackTrace();
}

?????????????????????????????????????Java NIO??????socket???????????

????2??IoProcessor

???????????IoAcceptor??IoConnector????????IoProcessor???????IO?????????IoProcessor????IoProcessor???????????IoProcessor??????С??????????CPU????+1??????????????IoProcessor???????С????3????????ExecutorFilter????????????????IoProcessor??????IoSession

????acceptor.getFilterChain().addLast("threadpool"??new  ExecutorFilter(corePoolSize?? maximumPoolSize?? keepAliveTime??unit)