Returns the queue from the shared memory.

@param  $nQueueKey @type integer The key of the queue stored in the shared
memory.
@param  $nProcess @type integer @optional The process cardinal number.
@return @type array Array of messages from the queue.
332438
protected function _getQueue($nQueueKey, $nProcess = 0)
	{
		if (!shm_has_var($this->_hShm, $nQueueKey + $nProcess)) {
			return array();
		}
		return shm_get_var($this->_hShm, $nQueueKey + $nProcess);
	}
35897
public function countMessagesInQueues(): int
    {
        return array_sum(array_map(function ($queueName) {
            return $this->queue($queueName)->declareQueue();
        }, $this->getQueueNames()));
    }
344633
AsteriskQueueImpl getQueueByName(String queueName)
    {
        refreshQueueIfForced(queueName);

        AsteriskQueueImpl queue = getInternalQueueByName(queueName);
        if (queue == null)
        {
            logger.error("Requested queue '" + queueName + "' not found!");
        }

        return queue;
    }
615041
public function getQueues(array $queueAlias): array
    {
        $queues = [];
        foreach ($queueAlias as $alias) {
            $queues[] = $this->getQueue($alias);
        }

        return $queues;
    }
573523
public static <T> Queue<T> newConcurrentQueue(int maxSize) {

        if (maxSize == Integer.MAX_VALUE) {
            return new ConcurrentLinkedDeque<>();
        }

        return maxSize > ARRAY_QUEUE_THRESHOLD ? new LinkedBlockingQueue<>(maxSize) : new ArrayBlockingQueue<>(maxSize);
    }
458243
public function getQueued($queuedCallUuid)
    {
        if (ArrayOperations::checkNull([$queuedCallUuid])) {
            throw
            new PlivoValidationException(
                'queued call uuid is mandatory');
        }

        $params = ['status' => 'queued'];

        $response = $this->client->fetch(
            $this->uri . $queuedCallUuid . '/',
            $params
        );

        return new CallQueued(
            $this->client,
            $response->getContent(),
            $this->pathParams['authId']);
    }
672795
protected function receiveMessage(array $queues, int $timeout, int $redeliveryDelay): ?RedisMessage
    {
        $startAt = time();
        $thisTimeout = $timeout;

        if (null === $this->queueNames) {
            $this->queueNames = [];
            foreach ($queues as $queue) {
                $this->queueNames[] = $queue->getName();
            }
        }

        while ($thisTimeout > 0) {
            $this->migrateExpiredMessages($this->queueNames);

            if (false == $result = $this->getContext()->getRedis()->brpop($this->queueNames, $thisTimeout)) {
                return null;
            }

            $this->pushQueueNameBack($result->getKey());

            if ($message = $this->processResult($result, $redeliveryDelay)) {
                return $message;
            }

            $thisTimeout -= time() - $startAt;
        }

        return null;
    }
548998
protected String pop(final String curQueue) {
        final String key = key(QUEUE, curQueue);
        final String now = Long.toString(System.currentTimeMillis());
        final String inflightKey = key(INFLIGHT, this.name, curQueue);
        return PoolUtils.doWorkInPoolNicely(this.jedisPool, new PoolWork<Jedis, String>() {
            /**
             * {@inheritDoc}
             */
            @Override
            public String doWork(final Jedis jedis) {
                switch (nextQueueStrategy) {
                    case DRAIN_WHILE_MESSAGES_EXISTS:
                        return (String) jedis.evalsha(popScriptHash.get(), 3, key, inflightKey,
                                JesqueUtils.createRecurringHashKey(key), now);
                    case RESET_TO_HIGHEST_PRIORITY:
                        return (String) jedis.evalsha(multiPriorityQueuesScriptHash.get(), 3, curQueue, inflightKey, namespace, now);
                    default:
                        throw new RuntimeException("Unimplemented 'nextQueueStrategy'");
                }
            }
        });
    }
1033254
public function get($hostname, $cb, $noncache = false, $nameServers = [], $proto = 'udp')
    {
        $pool = $this;
        if (!$nameServers) {
            $nameServers = $this->nameServers;
        }
        if (!$this->preloading->hasCompleted()) {
            $this->preloading->addListener(function ($job) use (
                $hostname,
                $cb,
                $noncache,
                $pool,
                $nameServers,
                $proto
            ) {
                $pool->get($hostname, $cb, $noncache, $nameServers, $proto);
            });
            return;
        }
        $nameServer = reset($nameServers);
        $isIpv6 = filter_var($nameServer, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
        if ($isIpv6) {
            $nameServer = '[' . $nameServer . ']';
        }
        $onGetConnection = function ($conn) use ($cb, $hostname, $nameServers, $noncache, $pool, $proto) {
            if (!$conn || !$conn->isConnected()) {
                if ($proto === 'udp') {
                    //Fail to  connect via udp, trying by tcp
                    $pool->get($hostname, $cb, $noncache, $nameServers, 'tcp');
                    return;
                }
                array_shift($nameServers);
                if (!$nameServers) {
                    //Totally fail to resolve name
                    $cb(false);
                } else {
                    //Fail connect to curr Ns, but we can try another ns
                    $pool->get($hostname, $cb, $noncache, $nameServers, 'udp');
                }
            } else {
                $conn->get(
                    $hostname,
                    function ($response) use ($hostname, $cb, $proto, $noncache, $nameServers, $pool) {
                        if ($response === false && $proto === 'udp') {
                            //Fail to  connect via udp, trying by tcp
                            $pool->get($hostname, $cb, $noncache, $nameServers, 'tcp');
                        } else {
                            call_user_func($cb, $response);
                        }
                    }
                );
            }
        };
        list($host, $type, $class) = explode(':', $hostname . '::', 3);
        if ($type === 'AXFR') {
            $proto = 'tcp';
        }
        $this->getConnection($proto . '://' . $nameServer, $onGetConnection);
        return;
    }
491561
public String getQueueName(boolean bDefaultIfNone)
    {
        String strName = null;
        Record recQueueName = ((ReferenceField)this.getField(MessageProcessInfo.QUEUE_NAME_ID)).getReference();
        if ((recQueueName != null) && (recQueueName.getEditMode() == DBConstants.EDIT_CURRENT))
            strName = recQueueName.getField(QueueName.CODE).toString();
        if ((strName == null) || (strName.length() == 0))
            if (bDefaultIfNone)
        {
            int iMessageInfoType = MessageInfoType.REQUEST_ID;
            Record recMessageInfo = ((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference();
            if ((recMessageInfo != null) && (recMessageInfo.getEditMode() == DBConstants.EDIT_CURRENT))
                iMessageInfoType = (int)recMessageInfo.getField(MessageInfo.MESSAGE_INFO_TYPE_ID).getValue();
            if (iMessageInfoType == MessageInfoType.REQUEST_ID)
                strName = MessageConstants.TRX_SEND_QUEUE;
            else
                strName = MessageConstants.TRX_RECEIVE_QUEUE;
        }
        return strName;
    }
728338
public function getMessageQueue() {

        $session      = $this->getSession();
        $sessionQueue = $session->get('application.queue');

        if (isset($sessionQueue) && count($sessionQueue)) {
            $this->_messageQueue = array_merge($sessionQueue, $this->_messageQueue);
            $session->set('application.queue', null);
        }

        return $this->_messageQueue;
    }
662215
public function getMessagesCurrentCountOnQueue($queue)
    {
        try {
            return $this->queue->getQueue($queue)->size;
        } catch (\Http_Exception $ex) {
            \PHPUnit\Framework\Assert::fail("queue [$queue] not found");
        }
    }
867196
public long getNumberOfQueuedMessages() {
		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
			SibTr.entry(tc, "getNumberOfQueuedMessages");

		long depth = itemStream.getTotalMsgCount();

		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
			SibTr.exit(tc, "getNumberOfQueuedMessages", Long.valueOf(depth));

		return depth;
	}
506502
private static com.enioka.jqm.api.Queue getQueue(Queue queue)
    {
        com.enioka.jqm.api.Queue q = new com.enioka.jqm.api.Queue();

        q.setDescription(queue.getDescription());
        q.setId(queue.getId());
        q.setName(queue.getName());

        return q;
    }
784349
def queues(key=nil)
      return nil if @shutdown_mutex.locked?

      return @queues if key.nil?

      # First try to return the queue named 'key' if it's available.
      return @queues[key] if @queues[key]

      # If the queue wasn't available, create or get the mutex that will
      # wrap creation of the Queue.
      @queue_init_mutexes[key] ||= Mutex.new

      # Otherwise, check to see if another process is already loading
      # the queue named 'key'.
      if @queue_init_mutexes[key].locked?
        # return an empty/false result if we're waiting for the queue
        # to be loaded and we're not the first process to request the queue
        return nil
      else
        begin
          @queue_init_mutexes[key].lock
          # we've locked the mutex, but only go ahead if the queue hasn't
          # been loaded. There's a race condition otherwise, and we could
          # end up loading the queue multiple times.
          if @queues[key].nil?
            @queues[key] = PersistentQueue.new(@path, key)
            @stats[:current_bytes] += @queues[key].initial_bytes
          end
        rescue Object => exc
          puts "ZOMG There was an exception reading back the queue. That totally sucks."
          puts "The exception was: #{exc}. Backtrace: #{exc.backtrace.join("\n")}"
        ensure
          @queue_init_mutexes[key].unlock
        end
      end

      return @queues[key]
    end
658696
public function unserialize($serialized)
    {
        // Get the semaphore key and attempt to re-connect to the semaphore in memory.
        list($this->key, $this->maxLocks) = unserialize($serialized);

        if (msg_queue_exists($this->key)) {
            $this->queue = msg_get_queue($this->key);
        }
    }
1018923
public function getRecipient($nRecipient = 0)
	{
		if (!isset($this->_aDeviceTokens[$nRecipient])) {
			throw new ApnsPHP_Message_Exception(
				"No recipient at index '{$nRecipient}'"
			);
		}
		return $this->_aDeviceTokens[$nRecipient];
	}