This must run ON the IO thread
327733
@Override
    public void doExceptionCaught(final long sessionId, final Throwable cause) throws Exception {
        ThreadGatewayStats stats = gatewayStats.get();
        stats.doExceptionCaught();
    }
1152322
def run(self, input_fname, ids_per_job, stagger=0, **wait_params):
        
        submit_thread = Thread(target=self.submit_reading,
                               args=(input_fname, 0, None, ids_per_job),
                               kwargs={'stagger': stagger},
                               daemon=True)
        submit_thread.start()
        self.watch_and_wait(**wait_params)
        submit_thread.join(0)
        if submit_thread.is_alive():
            logger.warning("Submit thread is still running even after job"
                           "completion.")
        return
1217124
def run(self):
        
        luigi.LocalTarget(path=self.fixture).copy(self.output().path)
669566
def run( self ):
        

        self.handshake()

        try:
            self.loop()
        except socket.error, se:
            if self.finished:
                return True
            else:
                raise
1108822
def run(cmd, filename=None, threads=True, verbose=False):
    """"""
    _run(threads, verbose, 'run', filename, cmd)
231574
def start(self, threaded=True):
        
        self.running = True
        if threaded:
            self._thread = Thread(target=self._run)
            self._thread.start()
        else:
            self._run()
451637
public synchronized void run(){	
		while (true){
			try {
				if (incoming == null) {
		            wait();	            
		        }
				
				System.out.println("Socket opening ...");
				BufferedReader in = new BufferedReader(new InputStreamReader(
						incoming.getInputStream(), "UTF-8"));				
				//PrintStream out = (PrintStream) incoming.getOutputStream();
				BufferedWriter out = new BufferedWriter(new OutputStreamWriter(
						incoming.getOutputStream(), "UTF-8"));
				
				String content = "";
				
				while (true){				
					int ch = in.read();
					if (ch == 0) //end of string
						break;
					
					content += (char) ch;
				}
				
				//System.out.println(content);
				String tagged = textpro.process(content);
				//Thread.sleep(4000);
				
				out.write(tagged.trim());
				out.write((char)0);
				out.flush();
			}
			catch (InterruptedIOException e){
				System.out.println("The conection is interrupted");	
			}
			catch (Exception e){
				System.out.println(e);
				e.printStackTrace();
			}
			
			//update pool
			//go back in wait queue if there is fewer than max
			this.setSocket(null);
			Vector<Session> pool = TaggingService.pool;
			synchronized (pool) {
				if (pool.size() >= TaggingService.maxNSession){
					/* too many threads, exit this one*/
					return;
				}
				else {				
					pool.addElement(this);
				}
			}
		}
	}
435341
def run(self):
        
        while True:
            try:
                self._callback(self.wait_read_frame())
            except ThreadQuitException:
                # Expected termintation of thread due to self.halt()
                break
            except Exception as e:
                # Unexpected thread quit.
                if self._error_callback:
                    self._error_callback(e)
370760
@Override
    public void run() {
        try {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){  
                Tr.debug(tc, "Run WriteListenerRunnable start , current thread -->" + Thread.currentThread().getName());
            }
            // clean up everything on this thread
            WebContainerRequestState reqState = WebContainerRequestState.getInstance(false);
            if (reqState != null) {
                reqState.init();
            }
            // Push the original thread's context onto the current thread, also
            // save off the current thread's context
            _tcm.pushContextData();

            // call onWritePossible
            synchronized (this._out) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){  
                    Tr.debug(tc, "Invoking the onWritePossible first time");
                }
                WebContainerRequestState.getInstance(true).setAttribute("com.ibm.ws.webcontainer.upgrade.WriteAllowedonThisThread", true);
                this._listener.onWritePossible();

            }
        } catch (Exception e) {
            // If any other exception is thrown then call error which will set
            // exception from error which will allow application to write error
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){  
                Tr.debug(tc, "An exception occurred during the onWritePossible : " + e);
            }
            _cb.error(_out.getBufferHelper().get_vc(), e);

        } finally {
            // Revert back to the thread's current context
            _tcm.popContextData();
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){  
                Tr.debug(tc, "Run WriteListenerRunnable done");
            }
        }
    }
73361
public void run() {

		try {
			while (true) {
				//server thread blocks until a client connects
				Socket socket = server.accept();

				System.out.println(new LogEntry("client (" + socket.getInetAddress().getHostAddress() + ") attempts to connect..."));
				Connection c = establishConnection(socket);
				updateConnectedClients(c);
			}
		} catch (IOException ioe) {
			System.out.println(new LogEntry("server forced to stop with message " + ioe.getClass().getName() + ' ' + ioe.getMessage()));
		} catch (Throwable t) {
			System.out.println(new LogEntry(Level.CRITICAL, "server forced to stop with message " + t.getClass().getName() + ' ' + t.getMessage(), t));
		}
	}
920064
def Run(self):
    """"""
    count = 0
    for count, input_data in enumerate(self.GetInput()):
      if count % 2000 == 0:
        logging.debug("%d processed.", count)
      args = (input_data, self.out_queue, self.token)
      self.thread_pool.AddTask(
          target=self.IterFunction, args=args, name=self.THREAD_POOL_NAME)

    while count >= 0:
      try:
        # We only use the timeout to wait if we got to the end of the Queue but
        # didn't process everything yet.
        out = self.out_queue.get(timeout=self.QUEUE_TIMEOUT, block=True)
        if out:
          yield out
          count -= 1
      except queue.Empty:
        break

    # Join and stop to clean up the threadpool.
    self.thread_pool.Stop(join_timeout=THREADPOOL_JOIN_TIMEOUT)
1210539
public void run() {
    while (running) {
      try {
        LOG.info("FileFixer continuing to run...");
        doFindFiles();
      } catch (Exception e) {
        LOG.error(StringUtils.stringifyException(e));
      } catch (Error err) {
        LOG.error("Exiting after encountering " +
                    StringUtils.stringifyException(err));
        shutdown();
        throw err;
      }
      try {
        // Sleep before proceeding to fix more files.
        Thread.sleep(blockFixInterval);
      } catch (InterruptedException ie) {
        LOG.error("Encountering InturruptedException " +
                   StringUtils.stringifyException(ie));
      }
    }
  }
715544
def run(self):
        '''
        
        '''
        self.thread = Thread(target=self.__processQueue)
        self.thread.start()
431281
def run(self):
        '''
        
        '''
        salt.utils.process.appendproctitle(self.__class__.__name__)
        self.event = get_event('master', opts=self.opts, listen=True)
        events = self.event.iter_events(full=True)
        self.event.fire_event({}, 'salt/event_listen/start')
        try:
            for event in events:
                if event['tag'] == 'salt/event/exit':
                    self.stop = True
                if self._filter(event):
                    self.event_queue.append(event)
                if len(self.event_queue) >= self.event_return_queue:
                    self.flush_events()
                if self.stop:
                    break
        finally:  # flush all we have at this moment
            if self.event_queue:
                self.flush_events()
1117014
def run(self):
        
        listener_thr = _spawn(self.receiver.run)
        callback_thr = _spawn(self.callbacks.run)
        sender_thr = _spawn(self.sender.run)
        logger_thr = _spawn(self.logger.run)

        self.connect()
        try:
            yield
        finally:
            self.stop()

            # Wait for the listener to finish.
            listener_thr.join()
            self.callbacks.put('shutdown')

            # Tell the other threads to finish, and wait for them.
            for obj in [self.callbacks, self.sender, self.logger]:
                obj.stop()
            for thr in [callback_thr, sender_thr, logger_thr]:
                thr.join()
302433
def start(self):
        """"""
        assert self._thread is None, 'thread already started'

        # configure thread
        self._thread = Thread(target=self._start_io_loop)
        self._thread.daemon = True

        # begin thread and block until ready
        self._thread.start()
        self._ready.wait()
365210
def run(self):
        ''''''
        with spawn_output_reader() as (stdout_capture, stdout_thread):
            with spawn_output_reader() as (stderr_capture, stderr_thread):
                context = starter_iocontext(stdout_capture, stderr_capture)
                status = self._exec(context)
        stdout_bytes = stdout_thread.join()
        stderr_bytes = stderr_thread.join()
        result = Result(status.code, stdout_bytes, stderr_bytes)
        if is_checked_error(status):
            raise StatusError(result, self)
        return result