Processes the Client queue, and passes the data to the respective
        methods.
        :return:
332554
def process(self):
        

        while self.running:
            if self._processor_lock.acquire(blocking=False):

                if self.ping_timer:
                    try:
                        self._check_ping()
                    except TimeoutError:
                        log.exception("BitfinexWSS.ping(): TimedOut! (%ss)" %
                                      self.ping_timer)
                    except (WebSocketConnectionClosedException,
                            ConnectionResetError):
                        log.exception("BitfinexWSS.ping(): Connection Error!")
                        self.conn = None
                if not self.conn:
                    # The connection was killed - initiate restart
                    self._controller_q.put('restart')

                skip_processing = False

                try:
                    ts, data = self.receiver_q.get(timeout=0.1)
                except queue.Empty:
                    skip_processing = True
                    ts = time.time()
                    data = None

                if not skip_processing:
                    log.debug("Processing Data: %s", data)
                    if isinstance(data, list):
                        self.handle_data(ts, data)
                    else:  # Not a list, hence it could be a response
                        try:
                            self.handle_response(ts, data)
                        except UnknownEventError:

                            # We don't know what event this is- Raise an
                            # error & log data!
                            log.exception("main() - UnknownEventError: %s",
                                          data)
                            log.info("main() - Shutting Down due to "
                                     "Unknown Error!")
                            self._controller_q.put('stop')
                        except ConnectionResetError:
                            log.info("processor Thread: Connection Was reset, "
                                     "initiating restart")
                            self._controller_q.put('restart')

                self._check_heartbeats(ts)
                self._processor_lock.release()
            else:
                time.sleep(0.5)
1163493
function processQueue() {
        var queue = nextTick.queue;
        var digest = nextTick.digest;

        nextTick.queue = [];
        nextTick.timeout = null;
        nextTick.digest = false;

        queue.forEach(function(queueItem) {
          var skip = queueItem.scope && queueItem.scope.$$destroyed;
          if (!skip) {
            queueItem.callback();
          }
        });

        if (digest) $rootScope.$digest();
      }
1279873
protected void processQueue() {
        try {
            Collection<RequestMetric> batch = new ArrayList<>(this.batchSize);
            RequestMetric rm = queue.take();
            batch.add(rm);
			queue.drainTo(batch, this.batchSize - 1);
			
			Builder builder = new Bulk.Builder();
			for (RequestMetric metric : batch) {
	            Index index = new Index.Builder(metric).refresh(false)
	                    .index(getIndexName())
	                    .type("request").build(); //$NON-NLS-1$
				builder.addAction(index);
			}
            
            BulkResult result = getClient().execute(builder.build());
            if (!result.isSucceeded()) {
                logger.warn("Failed to add metric(s) to ES"); //$NON-NLS-1$
            }
        } catch (Exception e) {
            logger.warn("Error adding metric to ES"); //$NON-NLS-1$
            return;
        }
    }
487885
def flush(self):
        

        done = threading.Event()

        def _callback():
            done.set()

        self.defer(_callback)
        done.wait()
322295
def process_data(self):
        ""

        try:
            reader = getattr(self.socket, 'read', self.socket.recv)
            new_data = reader(2 ** 14)
        except socket.error:
            # The server hung up.
            self.disconnect("Connection reset by peer")
            return
        if not new_data:
            # Read nothing: connection must be down.
            self.disconnect("Connection reset by peer")
            return

        self.buffer.feed(new_data)

        # process each non-empty line after logging all lines
        for line in self.buffer:
            log.debug("FROM SERVER: %s", line)
            if not line:
                continue
            self._process_line(line)
1207073
function processQueue(){
      try {
        // mark queue as processing to avoid concurrency
        processing = true;

        // process queue
        var item;
        while (item = queue.shift())
          item.fn.call(item.context);
      } finally {
        // queue is not processing anymore
        processing = false;

        // if any function in queue than exception was occured,
        // run rest functions in next code frame
        if (queue.length)
          timer = setImmediate(process);
      }
    }
1190322
def service_executions(self, *args, **kwargs):
        
        return self._client.service_executions(*args, scope=self.id, **kwargs)
1098656
function() {
		if(!_self.waitingForResponse && _self.queue.length) {
			_self.waitingForResponse = true;
			var cmd = _self.queue.shift();

			if(_self.conn) {
				_self.conn.removeAllListeners('data');
				_self.conn.addListener('data', function(data) {
					Debug.log('response:');
					Debug.log(data);
					cmd.responseHandler.call(cmd, data);
				});
			}
			Debug.log('request:');
			Debug.log(cmd.command());
			process.nextTick(function() {
				_self.conn.write(cmd.command());
			});
		}
	}
711981
private void processQueue()
    {
        CacheEntry sv;
        while((sv = (CacheEntry) queue.poll()) != null)
        {
            sessionCache.remove(sv.oid);
        }
    }
1049371
private void sendQueuedInvocations() {
        while (true) {
            MethodInvocation<?> currentRPC = queuedRpcList.poll();
            if (currentRPC == null) {
                return;
            }

            try {
                connector.executeAsyncMethod(currentRPC.getProxy(),
                                             currentRPC.getMethod(),
                                             currentRPC.getArgs(),
                                             currentRPC.getFuture());
            } catch (JoynrRuntimeException e) {
                currentRPC.getFuture().onFailure(e);
            } catch (Exception e) {
                currentRPC.getFuture().onFailure(new JoynrRuntimeException(e));
            }

        }

    }
448888
def dispatch_queue(self):
        
        self.queue_lock.acquire()
        q = list(self.queue)
        self.queue = []
        self.queue_lock.release()
        log.debug("Dispatching requests: {}".format(q))
        for req in q:
            req.response = self.dispatch_request(req)
        for req in q:
            req.signal()
34317
def process_requests(self):
        
        while True:
            id, args, kwargs = self.request_queue.get()
            try:
                response = self._make_request(*args, **kwargs)
            except Exception as e:
                response = e
            self.results[id] = response
427500
def _run_queued_callbacks(self):
        '''  '''
        for callback in self._queued_callbacks:
            try:
                callback()
            except Exception as ex:
                logger.error("Exception: %s" % str(ex))
384785
def get_data(self, **kwargs):
        '''
        
        '''
        if self.queue:
            new = self.apply_queued()
            return new.get_data()
        else:
            return self._get_attr_from_file('data', **kwargs)
1198900
@SuppressWarnings("nls")
    protected void processQueue() {
        try {
            RequestMetric metric = queue.take();
            QueryRunner run = new QueryRunner(ds);

            Calendar cal = Calendar.getInstance();
            cal.setTimeZone(TimeZone.getTimeZone("UTC"));
            cal.setTime(metric.getRequestStart());
            
            long rstart = cal.getTimeInMillis();
            long rend = metric.getRequestEnd().getTime();
            long duration = metric.getRequestDuration();
            cal.set(Calendar.MILLISECOND, 0);
            cal.set(Calendar.SECOND, 0);
            long minute = cal.getTimeInMillis();
            cal.set(Calendar.MINUTE, 0);
            long hour = cal.getTimeInMillis();
            cal.set(Calendar.HOUR_OF_DAY, 0);
            long day = cal.getTimeInMillis();
            cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
            long week = cal.getTimeInMillis();
            cal.set(Calendar.DAY_OF_MONTH, 1);
            long month = cal.getTimeInMillis();
            String api_org_id = metric.getApiOrgId();
            String api_id = metric.getApiId();
            String api_version = metric.getApiVersion();
            String client_org_id = metric.getClientOrgId();
            String client_id = metric.getClientId();
            String client_version = metric.getClientVersion();
            String plan = metric.getPlanId();
            String user_id = metric.getUser();
            String rtype = null;
            if (metric.isFailure()) {
                rtype = "failure";
            } else if (metric.isError()) {
                rtype = "error";
            }
            long bytes_up = metric.getBytesUploaded();
            long bytes_down = metric.getBytesDownloaded();

            // Now insert a row for the metric.
            run.update("INSERT INTO gw_requests ("
                    + "rstart, rend, duration, month, week, day, hour, minute, "
                    + "api_org_id, api_id, api_version, "
                    + "client_org_id, client_id, client_version, plan, "
                    + "user_id, resp_type, bytes_up, bytes_down) VALUES ("
                    + "?, ?, ?, ?, ?, ?, ?, ?,"
                    + "?, ?, ?,"
                    + "?, ?, ?, ?,"
                    + "?, ?, ?, ?)",
                    rstart, rend, duration, month, week, day, hour, minute,
                    api_org_id, api_id, api_version,
                    client_org_id, client_id, client_version, plan,
                    user_id, rtype, bytes_up, bytes_down
                    );
        } catch (InterruptedException ie) {
            // This means that the thread was stopped.
        } catch (Exception e) {
            // TODO better logging of this unlikely error
            System.err.println("Error adding metric to database:"); //$NON-NLS-1$
            e.printStackTrace();
            return;
        }
    }
199464
def main():
    
    start_time = datetime.now()
    output_q = Queue(maxsize=20)

    procs = []
    for a_device in devices:
        my_proc = Process(target=show_version_queue, args=(a_device, output_q))
        my_proc.start()
        procs.append(my_proc)

    # Make sure all processes have finished
    for a_proc in procs:
        a_proc.join()

    while not output_q.empty():
        my_dict = output_q.get()
        for k, val in my_dict.items():
            print(k)
            print(val)

    print("\nElapsed time: " + str(datetime.now() - start_time))
1062524
def run_queues(self):
        """"""

        if self.exception:
            # pylint: disable=raising-bad-type
            raise self.exception
        listeners = self.__listeners_for_thread
        return sum(l.process() for l in listeners) > 0