{@inheritDoc}

@throws QueueException.EphemeralIsFull
if the ephemeral storage is full
429353
@Override
    public IQueueMessage<ID, DATA> take() throws QueueException.EphemeralIsFull {
        if (!isEphemeralDisabled()) {
            int ephemeralMaxSize = getEphemeralMaxSize();
            if (ephemeralMaxSize > 0 && ephemeralStorage.size() >= ephemeralMaxSize) {
                throw new QueueException.EphemeralIsFull(ephemeralMaxSize);
            }
        }
        IQueueMessage<ID, DATA> msg = takeFromRingBuffer();
        if (msg != null && !isEphemeralDisabled()) {
            ephemeralStorage.putIfAbsent(msg.getId(), msg);
        }
        return msg;
    }
428608
public void simulateFull(boolean isFull)
                    throws ObjectManagerException {
        final String methodName = "simulateFull";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass, methodName, new Object[] { new Boolean(isFull) });

        if (isFull) {
            // Clear as much space as we can.
            objectManagerState.waitForCheckpoint(true);
            // Reserve all of the available space.
            synchronized (this) {
                long available = storeFileSizeAllocated - storeFileSizeUsed - directoryReservedSize - reservedSize.get();
                long newReservedSize = reservedSize.addAndGet((int) available);
                simulateFullReservedSize = simulateFullReservedSize + available;
                if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
                    trace.debug(this, cclass, methodName, new Object[] { "isFull:834",
                                                                        new Long(available),
                                                                        new Long(newReservedSize),
                                                                        new Long(simulateFullReservedSize) });

            } // synchronized (this).

        } else {
            synchronized (this) {
                reservedSize.addAndGet((int) -simulateFullReservedSize);
                simulateFullReservedSize = 0;
            } // synchronized (this).
            objectManagerState.waitForCheckpoint(true);
        } // if (isFull).

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, methodName, new Object[] { new Long(simulateFullReservedSize) });
    }
1010637
public void setCapacity(String queue,float capacity) {
    rmConf.setFloat(toFullPropertyName(queue, CAPACITY_PROPERTY),capacity);
  }
588939
@Override
  public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    // TODO: do we need to write/read the capacity?
    out.writeInt(entries.length);
    for(Entry entry : entries) {
      if(entry == null) {
        break;
      }
      entry.writeExternal(out);
    }
  }
74450
@Override
    public int drainTo(Collection<E> collection) {
        int size = queue.drainTo(collection);
        addCapacity(-size);
        return size;
    }
990294
private void checkFull() {
    if (!full && messages.size() >= maxQueueSize) {
      full = true;
      log.debug(String.format("%s - Connection to %s is full", this, context.target()));
    }
  }
1041183
private synchronized boolean isQueueEmptyForSessionId (final short sessionId) {
     if (tc.isEntryEnabled()) SibTr.entry(this, tc, "isQueueEmptyForSessionId", "sessionId="+sessionId);

     boolean empty = true;
     final Iterator it = queue.iterator();
     while(it.hasNext()) {
       final QueueData data = (QueueData)it.next();
       final ProxyQueue pq = data.getProxyQueue();
       if (pq.getId() == sessionId) {
         if (tc.isDebugEnabled()) SibTr.debug(this, tc, "Found match: ", pq);
         empty = false;
         break;
       }
     }

     if (tc.isEntryEnabled()) SibTr.exit(this, tc, "isQueueEmptyForSessionId", Boolean.valueOf(empty));
     return empty;
   }
1324729
protected void putToQueue(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull {
        if (!queue.offer(msg)) {
            throw new QueueException.QueueIsFull(getBoundary());
        }
    }
969091
@Trivial
    public synchronized boolean isFull() {
        // final String methodName = "isFull()";
        boolean isFull = false;
        int size = this.explicitBuffer.size() + this.scanBuffer.size() + this.garbageCollectorBuffer.size();
        if (size > this.maxInvalidationBufferSize || (System.currentTimeMillis() - this.lastRemoveTime) >= this.maxInvalidationBufferLife) {
            isFull = true;
            setlastRemoveTime();
        }
        // if (isFull) {
        // traceDebug(methodName, "cacheName=" + this.cod.cacheName + " isFull=" + isFull + " explicitBuffer=" +
        // explicitBuffer.size() + " scanBuffer=" + this.scanBuffer.size());
        // }
        return isFull;
    }
702700
@Override
    public IQueueMessage<ID, DATA> take() throws QueueException.EphemeralIsFull {
        Document document;
        if (isEphemeralDisabled()) {
            document = getCollection().findOneAndDelete(FILTER_TAKE,
                    TAKE_EPHEMERAL_DISABLED_OPTIONS);
        } else {
            int ephemeralMaxSize = getEphemeralMaxSize();
            if (ephemeralMaxSize > 0 && ephemeralSize() >= ephemeralMaxSize) {
                throw new QueueException.EphemeralIsFull(ephemeralMaxSize);
            }
            String ephemeralId = QueueUtils.IDGEN.generateId128Hex();
            document = getCollection().findOneAndUpdate(FILTER_TAKE,
                    Updates.set(COLLECTION_FIELD_EPHEMERAL_KEY, ephemeralId), TAKE_OPTIONS);
        }
        return fromDocument(document);
    }
934260
@Override
  public void waitForBucketEmpty(String bucketName)
      throws IOException {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(bucketName),
        "bucketName must not be null or empty");

    for (int i = 0; i < BUCKET_EMPTY_MAX_RETRIES; i++) {
      // We only need one item to see the bucket is not yet empty.
      List<String> objectNames = listObjectNames(bucketName, null, PATH_DELIMITER, 1);
      if (objectNames.isEmpty()) {
        return;
      }
      try {
        sleeper.sleep(BUCKET_EMPTY_WAIT_TIME_MS);
      } catch (InterruptedException ignored) {
        // Ignore the exception and loop.
      }
    }
    throw new IOException("Internal error: bucket not empty: " + bucketName);
  }
137391
public synchronized void enqueue(final T o) throws IOException {
		assert o != null;
		fbaos.reset();
		BinIO.storeObject(o, fbaos);
		byteDiskQueue.enqueueInt(fbaos.length);
		byteDiskQueue.enqueue(fbaos.array, 0, fbaos.length);
		size++;
	}
1030213
private void emptyQueue() {
        if (queue == null) {
            return;
        }
        int startSize = cacheMap.size();
        while (true) {
            @SuppressWarnings("unchecked")
            CacheEntry<K,V> entry = (CacheEntry<K,V>)queue.poll();
            if (entry == null) {
                break;
            }
            K key = entry.getKey();
            if (key == null) {
                // key is null, entry has already been removed
                continue;
            }
            CacheEntry<K,V> currentEntry = cacheMap.remove(key);
            // check if the entry in the map corresponds to the expired
            // entry. If not, readd the entry
            if ((currentEntry != null) && (entry != currentEntry)) {
                cacheMap.put(key, currentEntry);
            }
        }
        if (DEBUG) {
            int endSize = cacheMap.size();
            if (startSize != endSize) {
                System.out.println("*** Expunged " + (startSize - endSize)
                        + " entries, " + endSize + " entries left");
            }
        }
    }
444277
@Override
	// @NotThreadSafe
	protected void ensureCapacity(long capacity) throws IOException {
		long curCapacity = pbuffer.capacity();
		if(curCapacity<capacity) expandCapacity(curCapacity, capacity);
	}
382085
public boolean isEmpty() throws SIConnectionDroppedException
   {
      synchronized(queueMonitor)
      {
         if (state == CLOSED) throw new SIConnectionDroppedException(TraceNLS.getFormattedMessage(JFapChannelConstants.MSG_BUNDLE, "PRIORITY_QUEUE_PURGED_SICJ0077", null, "PRIORITY_QUEUE_PURGED_SICJ0077"));
         return totalQueueDepth == 0;
      }
   }
330543
@Override
	public void put(E e) throws InterruptedException {
		if (sizeLimit > 0){
	        final ReentrantLock lock = this.sizeLimitLock;
	        lock.lockInterruptibly();
	        try {
	            try {
	                while (size() >= sizeLimit)
	                    withinSizeLimit.await();
	            } catch (InterruptedException ie) {
	            	withinSizeLimit.signal(); // propagate to non-interrupted thread
	                throw ie;
	            }
	            queue.put(e);
	        } finally {
	            lock.unlock();
	        }
		}else{
			queue.put(e);
		}
	}
984252
@Override
    public java.util.concurrent.Future<DeleteQueueResult> deleteQueueAsync(String queueUrl) {

        return deleteQueueAsync(new DeleteQueueRequest().withQueueUrl(queueUrl));
    }