1 17 18 package org.apache.tomcat.util.net; 19 20 import java.net.Socket ; 21 import org.apache.tomcat.util.threads.ThreadPoolRunnable; 22 23 33 class LeaderFollowerWorkerThread implements ThreadPoolRunnable { 34 40 PoolTcpEndpoint endpoint; 41 42 public LeaderFollowerWorkerThread(PoolTcpEndpoint endpoint) { 43 this.endpoint = endpoint; 44 } 45 46 public Object [] getInitData() { 47 Object obj[]=new Object [2]; 49 obj[1]= endpoint.getConnectionHandler().init(); 50 obj[0]=new TcpConnection(); 51 return obj; 52 } 53 54 public void runIt(Object perThrData[]) { 55 56 if (endpoint.isRunning()) { 58 59 while (endpoint.isPaused()) { 61 try { 62 Thread.sleep(1000); 63 } catch (InterruptedException e) { 64 } 66 } 67 68 Socket s = null; 70 try { 71 s = endpoint.acceptSocket(); 72 } finally { 73 if (endpoint.isRunning()) { 75 endpoint.tp.runIt(this); 76 } 77 } 78 79 if (null != s) { 81 endpoint.processSocket(s, (TcpConnection) perThrData[0], (Object []) perThrData[1]); 82 } 83 84 } 85 } 86 87 } 88 | Popular Tags |