【nio服务端序列图】
一:nio服务器启动类
1 package com.yeepay.sxf.testnio; 2 /** 3 * nio创建的的timerServer服务器 4 * 5 * @author sxf 6 * 7 */ 8 public class NIOTimerServer { 9 10 /** 11 * nio服务器启动的入口 12 * @param args 13 */ 14 public static void main(String[] args) { 15 //启动服务器绑定的端口号 16 int port=8000; 17 //获取端口号 18 if(args!=null && args.length>0){ 19 try { 20 port=Integer.valueOf(args[0]); 21 } catch (Exception e) { 22 e.printStackTrace(); 23 } 24 } 25 26 //新建nio服务器类 27 MultiplexerTimerServer timerServer=new MultiplexerTimerServer(port); 28 29 //启动服务类的主线程 30 new Thread(timerServer,"NIO-MultiplexerTimerServer-001").start(); 31 } 32 }