Package edu.emory.mathcs.backport.java.util.concurrent.locks

Examples of edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock.unlock()


                        if (queue[i] == replacement)
                            siftUp(i, replacement);
                    }
                }
            } finally {
                lock.unlock();
            }
            return removed;
        }

        public int size() {
View Full Code Here


            final ReentrantLock lock = this.lock;
            lock.lock();
            try {
                s = size;
            } finally {
                lock.unlock();
            }
            return s;
        }

        public boolean isEmpty() {
View Full Code Here

            final ReentrantLock lock = this.lock;
            lock.lock();
            try {
                return queue[0];
            } finally {
                lock.unlock();
            }
        }

        public boolean offer(Object x) {
            if (x == null)
View Full Code Here

                    siftUp(i, e);
                }
                if (notify)
                    available.signalAll();
            } finally {
                lock.unlock();
            }
            return true;
  }

        public void put(Object e) {
View Full Code Here

                if (first == null || first.getDelay(TimeUnit.NANOSECONDS) > 0)
                    return null;
                else
                    return finishPoll(first);
            } finally {
                lock.unlock();
            }
        }

        public Object take() throws InterruptedException {
            final ReentrantLock lock = this.lock;
View Full Code Here

                        else
                            return finishPoll(first);
                    }
                }
            } finally {
                lock.unlock();
            }
        }

        public Object poll(long timeout, TimeUnit unit)
            throws InterruptedException {
View Full Code Here

                        } else
                            return finishPoll(first);
                    }
                }
            } finally {
                lock.unlock();
            }
        }

        public void clear() {
            final ReentrantLock lock = this.lock;
View Full Code Here

                        setIndex(t, -1);
                    }
                }
                size = 0;
            } finally {
                lock.unlock();
            }
        }

        /**
         * Return and remove first element only if it is expired.
View Full Code Here

                }
                if (n > 0)
                    available.signalAll();
                return n;
            } finally {
                lock.unlock();
            }
        }

        public int drainTo(Collection c, int maxElements) {
            if (c == null)
View Full Code Here

                }
                if (n > 0)
                    available.signalAll();
                return n;
            } finally {
                lock.unlock();
            }
        }

        public Object[] toArray() {
            final ReentrantLock lock = this.lock;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.