/** * Inserts the specified element into this priority queue. * * @param e the element to add * @return {@code true} (as specified by {@link Collection#add}) * @throws ClassCastException if the specified element cannot be compared * with elements currently in the priority queue according to the * priority queue's ordering * @throws NullPointerException if the specified element is null */ public boolean add(E e) { return offer(e); }
/** * Inserts the specified element into this priority queue. * As the queue is unbounded, this method will never block. * * @param e the element to add * @throws ClassCastException if the specified element cannot be compared * with elements currently in the priority queue according to the * priority queue's ordering * @throws NullPointerException if the specified element is null */ public void put(E e) { offer(e); // never need to block }
void enqueueTask( ScheduledJobHandle newTasks ) { delayedTasks.offer( newTasks ); LockSupport.unpark( timeKeeper ); }
/** * Inserts the specified element into this priority queue. * As the queue is unbounded, this method will never block or * return {@code false}. * * @param e the element to add * @param timeout This parameter is ignored as the method never blocks * @param unit This parameter is ignored as the method never blocks * @return {@code true} (as specified by * {@link BlockingQueue#offer(Object,long,TimeUnit) BlockingQueue.offer}) * @throws ClassCastException if the specified element cannot be compared * with elements currently in the priority queue according to the * priority queue's ordering * @throws NullPointerException if the specified element is null */ public boolean offer(E e, long timeout, TimeUnit unit) { return offer(e); // never need to block }
@Override public boolean offer(T t) { lock.lock(); try { notEmpty.signal(); return super.offer(t); } finally { lock.unlock(); } }
@Override public boolean offer(T t) { lock.lock(); try { notEmpty.signal(); return super.offer(t); } finally { lock.unlock(); } } };
return null; boolean offerOK = this.requestQueue.offer(nextReq); if (!offerOK) { log.warn("never expected here, add a request to preallocate queue failed"); this.requestTable.remove(nextNextFilePath); } else { boolean offerOK = this.requestQueue.offer(nextNextReq); if (!offerOK) { log.warn("never expected here, add a request to preallocate queue failed");
@Override public void enqueue(T item) { queue.offer(item); }
this.hasException = true; if (null != req) { requestQueue.offer(req); try { Thread.sleep(1);
/** * OpenJDK offer(o, timeout, unit) calls offer(o), so use offer(o) to avoid dup stamping. * Non blocking. Returns false if full. * @param timeout ignored * @param unit ignored * @deprecated use offer(o) */ @Deprecated @Override public boolean offer(E o, long timeout, TimeUnit unit) { timestamp(o); if (size() >= MAX_SIZE) { _context.statManager().addRateData(STAT_FULL, 1); return false; } return super.offer(o, timeout, unit); }
/** * Returns false if full */ @Override public boolean offer(E o) { timestamp(o); if (size() >= MAX_SIZE) { _context.statManager().addRateData(STAT_FULL, 1); return false; } return super.offer(o); }
return null; boolean offerOK = this.requestQueue.offer(nextReq); if (!offerOK) { log.warn("never expected here, add a request to preallocate queue failed"); this.requestTable.remove(nextNextFilePath); } else { boolean offerOK = this.requestQueue.offer(nextNextReq); if (!offerOK) { log.warn("never expected here, add a request to preallocate queue failed");
/** * Inserts the specified element into this priority queue. * * @param e the element to add * @return {@code true} (as specified by {@link Collection#add}) * @throws ClassCastException if the specified element cannot be compared * with elements currently in the priority queue according to the * priority queue's ordering * @throws NullPointerException if the specified element is null */ public boolean add(E e) { return offer(e); }
this.hasException = true; if (null != req) { requestQueue.offer(req); try { Thread.sleep(1);
void enqueueTask( ScheduledJobHandle newTasks ) { delayedTasks.offer( newTasks ); LockSupport.unpark( timeKeeper ); }
@Override public boolean offer(E e) { boolean r = super.offer(e); lastAddedTime = System.currentTimeMillis(); return r; }
@Override public boolean offer(T t) { lock.lock(); try { notEmpty.signal(); return super.offer(t); } finally { lock.unlock(); } } };
@Override public boolean offer(E e) { // Fuzzy, but good enough if (size() > capacity) { return false; } return super.offer(e); }
@Override public boolean offer(E e) { boolean s = super.offer(e); if (!s) { return false; } if (size() > maxSize) { poll(); } return true; }
@Override public boolean offer(E e) { boolean s = super.offer(e); if (!s) { return false; } if (size() > maxSize) { poll(); } return true; }