1 loop: while(true) 2 { 3 State state=_state.get(); 4 switch (state) 5 { 6 case PROCESSING: 7 // We can loop on _runChanges list without lock, because only access here. 8 int size = _runChanges.size(); 9 for (int i=0;i<size;i++) 10 runChange(_runChanges.get(i)); 11 _runChanges.clear();
1 protected void runChange(Runnable change) 2 { 3 try 4 { 5 if (LOG.isDebugEnabled()) 6 LOG.debug("Running change {}", change); 7 change.run(); 8 } 9 catch (Throwable x) 10 { 11 LOG.debug("Could not run change " + change, x); 12 } 13 }
图1 select()函数内部状态图
[Jetty9.3]-Jetty的NIO调度:ManagedSelector
原文:http://www.cnblogs.com/tecfans/p/4115912.html