Package jersey.repackaged.jsr166e

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


     * @return {@code true} if the element was added
     */
    public boolean addIfAbsent(E e) {
        boolean ret;
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            if (findFirstIndex(array, e, 0, count) < 0) {
                rawAdd(e);
                ret = true;
            }
View Full Code Here


            return new SubItr<E>(this, index + offset);
        }

        public E remove(int index) {
            final StampedLock lock = list.lock;
            long stamp = lock.writeLock();
            try {
                Object[] items = list.array;
                int i = index + offset;
                if (items == null || index < 0 || index >= size || i >= items.length)
                    throw new ArrayIndexOutOfBoundsException(index);
View Full Code Here

            }
        }

        public boolean remove(Object o) {
            final StampedLock lock = list.lock;
            long stamp = lock.writeLock();
            try {
                if (list.rawRemoveAt(findFirstIndex(list.array, o, offset,
                                                    offset + size))) {
                    --size;
                    return true;
View Full Code Here

    /** See {@link Vector#setSize} */
    public void setSize(int newSize) {
        if (newSize < 0)
            throw new ArrayIndexOutOfBoundsException(newSize);
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            Object[] items;
            int n = count;
            if (newSize > n)
                grow(newSize);
View Full Code Here

    }

    /** See {@link Vector#copyInto} */
    public void copyInto(Object[] anArray) {
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            Object[] items;
            if ((items = array) != null)
                System.arraycopy(items, 0, anArray, 0, count);
        } finally {
View Full Code Here

    }

    /** See {@link Vector#trimToSize} */
    public void trimToSize() {
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            Object[] items = array;
            int n = count;
            if (items != null && n < items.length)
                array = Arrays.copyOf(items, n);
View Full Code Here

    /** See {@link Vector#ensureCapacity} */
    public void ensureCapacity(int minCapacity) {
        if (minCapacity > 0) {
            final StampedLock lock = this.lock;
            long stamp = lock.writeLock();
            try {
                Object[] items = array;
                int cap = (items == null) ? 0 : items.length;
                if (minCapacity - cap > 0)
                    grow(minCapacity);
View Full Code Here

                throw new ArrayIndexOutOfBoundsException(index);
        }

        public boolean add(E element) {
            final StampedLock lock = list.lock;
            long stamp = lock.writeLock();
            try {
                int c = size;
                list.rawAddAt(c + offset, element);
                size = c + 1;
            } finally {
View Full Code Here

            return true;
        }

        public void add(int index, E element) {
            final StampedLock lock = list.lock;
            long stamp = lock.writeLock();
            try {
                if (index < 0 || index > size)
                    throw new ArrayIndexOutOfBoundsException(index);
                list.rawAddAt(index + offset, element);
                ++size;
View Full Code Here

        }

        public boolean addAll(Collection<? extends E> c) {
            Object[] elements = c.toArray();
            final StampedLock lock = list.lock;
            long stamp = lock.writeLock();
            try {
                int s = size;
                int pc = list.count;
                list.rawAddAllAt(offset + s, elements);
                int added = list.count - pc;
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.