Package jersey.repackaged.jsr166e

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


     * field under lock.
     */
    final boolean lockedRemoveAll(Collection<?> c, int origin, int bound) {
        boolean removed = false;
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            int n = count;
            int fence = bound < 0 || bound > n ? n : bound;
            if (origin >= 0 && origin < fence) {
                for (Object x : c) {
View Full Code Here


    final boolean lockedRetainAll(Collection<?> c, int origin, int bound) {
        final StampedLock lock = this.lock;
        boolean removed = false;
        if (c != this) {
            long stamp = lock.writeLock();
            try {
                Object[] items;
                int i, n;
                if ((items = array) != null && (n = count) > 0 &&
                    n < items.length && (i = origin) >= 0) {
View Full Code Here

    // public List methods

    public boolean add(E e) {
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            rawAdd(e);
        } finally {
            lock.unlockWrite(stamp);
        }
View Full Code Here

        return true;
    }

    public void add(int index, E element) {
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            rawAddAt(index, element);
        } finally {
            lock.unlockWrite(stamp);
        }
View Full Code Here

        Object[] elements = c.toArray();
        int len = elements.length;
        if (len == 0)
            return false;
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            Object[] items = array;
            int n = count;
            int newCount = n + len;
            if (items == null || newCount >= items.length)
View Full Code Here

    public boolean addAll(int index, Collection<? extends E> c) {
        Object[] elements = c.toArray();
        boolean ret;
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            ret = rawAddAllAt(index, elements);
        } finally {
            lock.unlockWrite(stamp);
        }
View Full Code Here

        return ret;
    }

    public void clear() {
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            int n = count;
            Object[] items = array;
            if (items != null) {
                for (int i = 0; i < n; i++)
View Full Code Here

    @SuppressWarnings("unchecked") public E remove(int index) {
        E oldValue = null;
        boolean oobe = false;
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            if (index < 0 || index >= count)
                oobe = true;
            else {
                oldValue = (E) array[index];
View Full Code Here

        return oldValue;
    }

    public boolean remove(Object o) {
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            return rawRemoveAt(findFirstIndex(array, o, 0, count));
        } finally {
            lock.unlockWrite(stamp);
        }
View Full Code Here

    @SuppressWarnings("unchecked") public E set(int index, E element) {
        E oldValue = null;
        boolean oobe = false;
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            Object[] items = array;
            if (items == null || index < 0 || index >= count)
                oobe = true;
            else {
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.