Examples of tryOptimisticRead()


Examples of jersey.repackaged.jsr166e.StampedLock.tryOptimisticRead()

        }
    }

    public E get(int index) {
        final StampedLock lock = this.lock;
        long stamp = lock.tryOptimisticRead();
        Object[] items;
        if (index >= 0 && (items = array) != null &&
            index < count && index < items.length) {
            @SuppressWarnings("unchecked") E e = (E)items[index];
            if (lock.validate(stamp))
View Full Code Here

Examples of jersey.repackaged.jsr166e.StampedLock.tryOptimisticRead()

        return idx;
    }

    public boolean isEmpty() {
        final StampedLock lock = this.lock;
        long stamp = lock.tryOptimisticRead();
        return count == 0; // no need for validation
    }

    public Iterator<E> iterator() {
        return new Itr<E>(this, 0);
View Full Code Here

Examples of jersey.repackaged.jsr166e.StampedLock.tryOptimisticRead()

        return oldValue;
    }

    public int size() {
        final StampedLock lock = this.lock;
        long stamp = lock.tryOptimisticRead();
        return count; // no need for validation
    }

    private int lockedSize() {
        int n;
View Full Code Here

Examples of jersey.repackaged.jsr166e.StampedLock.tryOptimisticRead()

    // Vector-only methods

    /** See {@link Vector#firstElement} */
    public E firstElement() {
        final StampedLock lock = this.lock;
        long stamp = lock.tryOptimisticRead();
        Object[] items;
        if ((items = array) != null && count > 0 && items.length > 0) {
            @SuppressWarnings("unchecked") E e = (E)items[0];
            if (lock.validate(stamp))
                return e;
View Full Code Here

Examples of jersey.repackaged.jsr166e.StampedLock.tryOptimisticRead()

    }

    /** See {@link Vector#lastElement} */
    public E lastElement() {
        final StampedLock lock = this.lock;
        long stamp = lock.tryOptimisticRead();
        Object[] items;
        int i;
        if ((items = array) != null && (i = count - 1) >= 0 &&
            i < items.length) {
            @SuppressWarnings("unchecked") E e = (E)items[i];
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.