This is the primary run method of the sound-playing threads.
18958
protected void spoolerRun ()
    {
        while (true) {
            try {
                SoundKey key;
                synchronized (_queue) {
                    _freeSpoolers++;
                    key = _queue.get(MAX_WAIT_TIME);
                    _freeSpoolers--;

                    if (key == null || key.cmd == DIE) {
                        _spoolerCount--;
                        // if dying and there are others to kill, do so
                        if (key != null && _spoolerCount > 0) {
                            _queue.appendLoud(key);
                        }
                        return;
                    }
                }

                // process the command
                processKey(key);

            } catch (Exception e) {
                log.warning(e);
            }
        }
    }
462191
@Override
    public void run() {
        if (this.state.compareAndSet(NEW, RUNNING)) {
            try {
                renameThread("RUNNING");
                this.threadRef.set(Thread.currentThread());
                PoolUtils.doWorkInPool(this.jedisPool, new PoolWork<Jedis, Void>() {
                    /**
                     * {@inheritDoc}
                     */
                    @Override
                    public Void doWork(final Jedis jedis) throws IOException {
                        jedis.sadd(key(WORKERS), name);
                        jedis.set(key(WORKER, name, STARTED), new SimpleDateFormat(DATE_FORMAT).format(new Date()));
                        listenerDelegate.fireEvent(WORKER_START, WorkerPoolImpl.this, null, null, null, null, null);
                        loadRedisScripts(jedis);
                        return null;
                    }
                });
                poll();
            } catch (Exception ex) {
                LOG.error("Uncaught exception in worker run-loop!", ex);
                this.listenerDelegate.fireEvent(WORKER_ERROR, this, null, null, null, null, ex);
            } finally {
                renameThread("STOPPING");
                this.listenerDelegate.fireEvent(WORKER_STOP, this, null, null, null, null, null);
                PoolUtils.doWorkInPoolNicely(this.jedisPool, new PoolWork<Jedis, Void>() {
                    /**
                     * {@inheritDoc}
                     */
                    @Override
                    public Void doWork(final Jedis jedis) {
                        jedis.srem(key(WORKERS), name);
                        jedis.del(key(WORKER, name), key(WORKER, name, STARTED), key(STAT, FAILED, name),
                                key(STAT, PROCESSED, name));
                        return null;
                    }
                });
                this.threadRef.set(null);
            }
        } else if (RUNNING.equals(this.state.get())) {
            throw new IllegalStateException("This WorkerImpl is already running");
        } else {
            throw new IllegalStateException("This WorkerImpl is shutdown");
        }
    }
819531
public void run() {
        while(running.get()) {
            try {
                Thread.sleep(gossipInterval);
            } catch(InterruptedException e) {
                Thread.currentThread().interrupt();
            }
            Node node = selectPeer();
            adminClient.setAdminClientCluster(metadataStore.getCluster());

            if(logger.isDebugEnabled())
                logger.debug("Starting gossip with " + node);

            for(String key: MetadataStore.GOSSIP_KEYS) {
                try {
                    gossipKey(node, key);
                } catch(VoldemortException e) {
                    logger.warn("Unable to Gossip key " + key + " with " + node, e);
                }
            }
        }
    }
1126678
@Override
	public void run() {
		Stopwatch stopwatch = SimonManager.getStopwatch(NAME);
		try (Split ignored = stopwatch.start();) {
			sleep(SLEEP);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		// signal to latch that the thread is finished
		latch.countDown();
	}
136637
public void startListening() throws FileNotFoundException, ClassNotFoundException, IOException,
        ResourceNotExistingException, TTException {
        mProcessingThread = new Thread() {
            public void run() {
                try {
                    processFileNotifications();
                } catch (InterruptedException | TTException | IOException e) {
                }
            }
        };
        mProcessingThread.start();

        initSessions();
    }
532110
def main(record_time, audio_sample_rate, audio_sample_width,
         audio_iter_size, audio_block_size, audio_flush_size):
    
    end_time = time.time() + record_time
    audio_device = SoundDeviceStream(sample_rate=audio_sample_rate,
                                     sample_width=audio_sample_width,
                                     block_size=audio_block_size,
                                     flush_size=audio_flush_size)
    stream = ConversationStream(source=audio_device,
                                sink=audio_device,
                                iter_size=audio_iter_size,
                                sample_width=audio_sample_width)
    samples = []
    logging.basicConfig(level=logging.INFO)
    logging.info('Starting audio test.')

    stream.start_recording()
    logging.info('Recording samples.')
    while time.time() < end_time:
        samples.append(stream.read(audio_block_size))
    logging.info('Finished recording.')
    stream.stop_recording()

    stream.start_playback()
    logging.info('Playing back samples.')
    while len(samples):
        stream.write(samples.pop(0))
    logging.info('Finished playback.')
    stream.stop_playback()

    logging.info('audio test completed.')
    stream.close()
629213
public void run()
    {
        m_thread = this;
        while (m_thread != null)
        {
            int iErrorCode = Constant.NORMAL_RETURN;
            BaseMessage message = (BaseMessage)this.receiveMessage();        // Hang until a message comes through
            if ((message == null) || (m_thread == null))
                return;      // End of processing, stop this thread.
            Iterator<BaseMessageFilter> iterator = this.getFilterList(message.getMessageHeader());
            while (iterator.hasNext())
            {
                if (message.isConsumed())
                    break;     // All done. with this message, continue with the next message.
                try {
                    BaseMessageFilter filter = iterator.next();
                    if (filter.isFilterMatch(message.getMessageHeader()))
                    {
                        BaseMessage messageToSend = message;
                        for (int i = 0; ; i++)
                        {
                            JMessageListener listener = filter.getMessageListener(i);
                            if (listener == null)
                                break;
                            if (filter.isThinTarget())
                                if (listener.isThinListener())
                            {
                                if (messageToSend == message)
                                    messageToSend = message.convertToThinMessage(); // If you are sending a thick message to a thin client, convert it first. Note: don't worry about calling this with a thin message... no conversion will be done there.
                                else
                                    messageToSend = messageToSend.convertToThinMessage();   // Previously processed but not converted
                            }
                            if (listener instanceof org.jbundle.model.Remote)
                                if (filter.getRegistryID() != null)
                                    if (messageToSend.getMessageHeader() != null)
                                        if (messageToSend.getMessageHeader().getRegistryIDMatch() == null)
                            {
                                try {
                                    if (messageToSend == message)
                                        messageToSend = (BaseMessage)messageToSend.clone(); // If I change the message, I need a new copy
                                } catch (CloneNotSupportedException e) {
                                    e.printStackTrace();
                                }
                                messageToSend.getMessageHeader().setRegistryIDMatch(filter.getRegistryID());    // Typically used for remote filters to match filter ID.
                            }
                            iErrorCode = listener.handleMessage(messageToSend);
                            if (iErrorCode != Constant.NORMAL_RETURN)
                                break;
                            message.setConsumed(messageToSend.isConsumed());
                            if (message.isConsumed())
                                break;     // All done. with this message, continue with the next message.
                        }
                    }
                } catch (ConcurrentModificationException ex)    {
                    Util.getLogger().warning("Message filter Concurrent Modification");   // Warning: Someone modified the filter list while I was cruzin it.
                    iterator = this.getFilterList(message.getMessageHeader());  // Start from the beginning again
                }
            }
        }
    }
196758
public void run()
    {
        Object objMessage = null;
        String[] files = this.getFileList();
        if (files == null)
            return;
        
        for (String strFile : files)
        {
            m_reader = this.getReader(strFile);
        
            try {
                while (true)
                {
                    objMessage = m_reader.readObject();
                    if (objMessage == null)
                        break;  // EOF = Done
                    
                    BaseBuffer buffer = new VectorBuffer((Vector)objMessage, BaseBuffer.PHYSICAL_FIELDS | BaseBuffer.MODIFIED_ONLY);
                    buffer.setHeaderCount(3);
                    String strTrxType = buffer.getHeader().toString();
                    String strTableName = buffer.getHeader().toString();
                    String strKey = buffer.getHeader().toString();
                    
                    try {
                        Record record = this.getRecord(strTableName);
                        if (record == null)
                        {
                        	ClassInfo recClassInfo = (ClassInfo)this.getMainRecord();
                            recClassInfo.addNew();
                            recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY);
                            recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strTableName);
                            if (recClassInfo.seek(DBConstants.EQUALS))
                            {
                                strTableName = recClassInfo.getPackageName(null) + '.' + strTableName;
                                record = Record.makeRecordFromClassName(strTableName, this);
                                this.disableAllListeners(record);
                                record.setAutoSequence(false);
                            }
                            else
                            {
                                if (!NOTRX.equalsIgnoreCase(strTrxType))
                                    System.out.println("Error - table not found: " + strTableName);
                                continue;
                            }
                        }
                        record.addNew();
                        record.getCounterField().setString(strKey);
                        if (ProxyConstants.ADD.equalsIgnoreCase(strTrxType))
                        {
                            buffer.bufferToFields(record, DBConstants.DISPLAY, DBConstants.READ_MOVE);
                            record.add();
                        }
                        else if (ProxyConstants.SET.equalsIgnoreCase(strTrxType))
                        {
                            if (record.seek(DBConstants.EQUALS))
                            {
                                record.edit();
                                buffer.bufferToFields(record, DBConstants.DISPLAY, DBConstants.READ_MOVE);
                                record.set();
                            }
                            else
                                System.out.println("Error - record not found: " + strTableName + ", key: " + strKey);
                        }
                        else if (ProxyConstants.REMOVE.equalsIgnoreCase(strTrxType))
                        {
                            if (record.seek(DBConstants.EQUALS))
                            {
                                record.edit();
                                record.remove();
                            }
                            else
                                System.out.println("Error - record not found: " + strTableName + ", key: " + strKey);
                        }
                    } catch (DBException e) {
                        e.printStackTrace();
                        System.out.println("Error - record: " + strTableName + ", key: " + strKey + " trx type: " + strTrxType);
                    }
                    
                    System.out.println("trxType: " + strTrxType + " record: " + strTableName + " key: " + strKey);
                }
                m_reader.close();
                m_reader = null;
            
            } catch (EOFException e) {
                // Ok - Done
            } catch (IOException e) {
                e.printStackTrace();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
        }
    }
1167937
public void run() {
        int emptyCount = 0;
        long scheduleTickTime = System.nanoTime();
        boolean isShutDown = false;
        activeDispatchers.incrementAndGet();
        try {
            while( ! isShutDown ) {
                try {
                    if ( pollQs() ) {
                        emptyCount = 0;
                        if ( System.nanoTime() - scheduleTickTime > SCHEDULE_TICK_NANOS) {
                            if ( emptySinceLastCheck == 0 ) // no idle during last interval
                            {
                                checkForSplit();
                            }
                            emptySinceLastCheck = 0;
                            scheduleTickTime = System.nanoTime();
                            schedulePendingAdds();
                        }
                    }
                    else {
                        emptyCount++;
                        emptySinceLastCheck++;
                        scheduler.pollDelay(emptyCount);
                        if (shutDown) // access volatile only when idle
                            isShutDown = true;
                        if ( scheduler.getBackoffStrategy().isSleeping(emptyCount) ) {
                            scheduleTickTime = 0;
                            schedulePendingAdds();
                            if ( System.currentTimeMillis()-created > 5000 ) {
                                if ( autoShutDown && actors.length == 0 && toAdd.peek() == null) {
                                    shutDown();
                                } else {
                                    scheduler.tryStopThread(this);
                                }
                            }
                        }
                    }
                } catch (Throwable th) {
                    Log.Warn(this, th, "from main poll loop");
                }
            }
            scheduler.threadStopped(this);
            LockSupport.parkNanos(1000*1000*1000);
            if ( actors.length > 0 || toAdd.peek() != null ) {
                if ( SimpleScheduler.DEBUG_SCHEDULING)
                    Log.Lg.warn(this, "zombie dispatcher thread detected. This can be a debugging artifact.");
                scheduler.tryStopThread(this);
            }
            if ( SimpleScheduler.DEBUG_SCHEDULING)
                Log.Debug(this,"dispatcher thread terminated "+getName());
        } finally {
            activeDispatchers.decrementAndGet();
        }
    }
144965
def run(self, channels=None, samplerate=None, blocksize=None):
        """"""

        source = self.processors[0]
        items = self.processors[1:]

        # Check if any processor in items need to force the samplerate
        force_samplerate = set([item.force_samplerate for item in items
                                if item.force_samplerate])
        if force_samplerate:
            if len(force_samplerate) > 1:
                raise(ValueError,
                      "Some processors specify different samplerate")
            force_samplerate = force_samplerate.pop()

            if samplerate and samplerate != force_samplerate:
                raise(ValueError, "A processor try to force the samplerate")

            samplerate = force_samplerate

        source.setup(channels=channels, samplerate=samplerate,
                     blocksize=blocksize)
        source.SIG_STOP = False
        last = source

        # setup/reset processors and configure properties throughout the pipe
        for item in items:
            item.source_mediainfo = source.mediainfo()
            item.setup(channels=last.channels(),
                       samplerate=last.samplerate(),
                       blocksize=last.blocksize(),
                       totalframes=last.totalframes())
            self._register_streamer(item)
            last = item

        # now stream audio data along the pipe
        if self._stream_thread:
            self._running_cond.acquire()
        self._is_running = True
        if self._stream_thread:
            self._running_cond.notify()
            self._running_cond.release()

        eod = False

        if source.id() == 'live_decoder':
            # Set handler for Interruption signal
            import signal

            def signal_handler(signum, frame):
                source.stop()

            signal.signal(signal.SIGINT, signal_handler)

        while not eod:
            frames, eod = source.process()
            for item in items:
                frames, eod = item.process(frames, eod)

        if source.id() == 'live_decoder':
            # Restore default handler for Interruption signal
            signal.signal(signal.SIGINT, signal.SIG_DFL)

        # Post-processing
        for item in items:
            item.post_process()

        # Release source
        source.release()
        # Release processors
        for item in items:
            item.release()

        self._is_running = False
1120734
public void run ()
    {
        log.info("DOMGR running.");

        // make a note of the thread that's processing events
        synchronized (this) {
            _dobjThread = Thread.currentThread();
        }

        while (isRunning()) {
            // pop the next unit off the queue and process it
            processUnit(_evqueue.get());
        }

        log.info("DOMGR exited.");
    }
305450
@Override
    public void run() {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        subjectRepository.getSubjectsCollection(new SubjectRepository.SubjectListCallback() {
            @Override
            public void onSubjectListLoader(final Collection<Subject> subjects) {
                mainThread.post(new Runnable() {
                    @Override
                    public void run() {
                        callback.onSubjectListLoaded(subjects);
                    }
                });
            }

            @Override
            public void onError(final SubjectException exception) {
                mainThread.post(new Runnable() {
                    @Override
                    public void run() {
                        callback.onError(exception);
                        Log.i(getClass().toString(), "Error!");
                    }
                });
            }
        });
    }
1086033
static double run(int num_threads) {

    final double membw[] = new double[num_threads];
    Thread[] threads = new Thread[num_threads];
    for (int t=0;t<num_threads;++t) {
      final int thread_num = t;
      threads[t] = new Thread() {
        public void run() {
          MemoryBandwidth l = new MemoryBandwidth();
          membw[thread_num] = l.run_benchmark();
        }
      };
    }
    for (int t=0;t<num_threads;++t) {
      threads[t].start();
    }
    for (int t=0;t<num_threads;++t) {
      try {
        threads[t].join();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }
    return Utils.sum(membw);
  }
625508
@Override
    public void run() {
        if (this.state.compareAndSet(NEW, RUNNING)) {
            try {
                renameThread("RUNNING");
                this.threadRef.set(Thread.currentThread());
                this.jedis.sadd(key(WORKERS), this.name);
                this.jedis.set(key(WORKER, this.name, STARTED), new SimpleDateFormat(DATE_FORMAT).format(new Date()));
                this.listenerDelegate.fireEvent(WORKER_START, this, null, null, null, null, null);
                loadRedisScripts();
                poll();
            } catch (Exception ex) {
                LOG.error("Uncaught exception in worker run-loop!", ex);
                this.listenerDelegate.fireEvent(WORKER_ERROR, this, null, null, null, null, ex);
            } finally {
                renameThread("STOPPING");
                this.listenerDelegate.fireEvent(WORKER_STOP, this, null, null, null, null, null);
                this.jedis.srem(key(WORKERS), this.name);
                this.jedis.del(key(WORKER, this.name), key(WORKER, this.name, STARTED), key(STAT, FAILED, this.name),
                        key(STAT, PROCESSED, this.name));
                this.jedis.quit();
                this.threadRef.set(null);
            }
        } else if (RUNNING.equals(this.state.get())) {
            throw new IllegalStateException("This WorkerImpl is already running");
        } else {
            throw new IllegalStateException("This WorkerImpl is shutdown");
        }
    }
336021
def start(self):
    

    if self.__running:
      raise RuntimeError('ThreadPool already running')
    [t.start() for t in self.__threads]
    self.__running = True
1013336
def run(self):
		
		if not hasattr(self, 'queue'):
			raise RuntimeError("Audio queue is not intialized.")
		self.keep_listening = True
		self.stream.start()
		
		while self.keep_listening:
			try:
				chunk = self.queue.get(timeout=queue_timeout)
				underflowed = self.stream.write(chunk)
				if underflowed:
					logger.debug("Buffer underrun")
			except Empty:
				pass

		self.stream.stop()
		self.stream.close()
1047959
public final void running () {
		Status previousStatus = status;
		status = Status.RUNNING;
		if (tree.listeners != null && tree.listeners.size > 0) tree.notifyStatusUpdated(this, previousStatus);
		if (control != null) control.childRunning(this, this);
	}