public void runIt(Object perThrData[]) { // Create per-thread cache if (endpoint.isRunning()) { // Loop if endpoint is paused while (endpoint.isPaused()) { try { Thread.sleep(1000); } catch (InterruptedException e) { // Ignore } } // Accept a new connection Socket s = null; try { s = endpoint.acceptSocket(); } finally { // Continue accepting on another thread... if (endpoint.isRunning()) { endpoint.tp.runIt(this); } } // Process the connection if (null != s) { endpoint.processSocket(s, (TcpConnection) perThrData[0], (Object[]) perThrData[1]); } } }
public void stopEndpoint() { if (running) { if (lf) { tp.shutdown(); } running = false; if (serverSocket != null) { closeServerSocket(); } if (!lf) { threadStop(); } initialized=false ; } }
/** * Start the background processing thread. */ public void start() { threadData = endpoint.getConnectionHandler().init(); thread = new ThreadWithAttributes(null, this); thread.setName(threadName); thread.setDaemon(true); thread.start(); }
public void startEndpoint() throws IOException, InstantiationException { if (!initialized) { initEndpoint(); } if (lf) { tp.start(); } running = true; paused = false; if (lf) { listener = new LeaderFollowerWorkerThread(this); tp.runIt(listener); } else { maxThreads = getMaxThreads(); threadStart(); } }
reinitializing = false; closeServerSocket(); initialized = false; msg = sm.getString("endpoint.warn.reinit"); log.warn(msg); initEndpoint(); } catch (Throwable t) { msg = sm.getString("endpoint.err.nonfatal", log.warn(msg); try { stopEndpoint(); initEndpoint(); startEndpoint(); } catch (Throwable t) { msg = sm.getString("endpoint.err.fatal",
setSocketOptions(s); if (getServerSocketFactory() != null) { getServerSocketFactory().handshake(s); con.setEndpoint(this); con.setSocket(s); getConnectionHandler().processConnection(con, threadData);
MasterSlaveWorkerThread workerThread = createWorkerThread(); if (workerThread == null) { try { Socket socket = acceptSocket();
/** * Start the background processing thread. */ private void threadStart() { thread = new Thread(this, tp.getName()); thread.setPriority(getThreadPriority()); thread.setDaemon(true); thread.start(); }
public Object[] getInitData() { // no synchronization overhead, but 2 array access Object obj[]=new Object[2]; obj[1]= endpoint.getConnectionHandler().init(); obj[0]=new TcpConnection(); return obj; }