Package java.util.concurrent.locks

Examples of java.util.concurrent.locks.Lock.lock()


        unit2.getType(className2).getFullyQualifiedName(),
        ILaunchManager.DEBUG_MODE);

    final Lock lock = new ReentrantLock();
    final Condition condition = lock.newCondition();
    lock.lock();
    try {
      // We had two breakpoints set, so we need to resume twice:
      while (suspendResume[0] == null) {
        condition.await(100, TimeUnit.MICROSECONDS);
      }
View Full Code Here


        return update;
    }

    private Lock getAndLock(String key) {
        Lock l = locks.get(key);
        l.lock();
        return l;
    }
}
View Full Code Here

    private ReadWriteLock sync = new ReentrantReadWriteLock();

    public boolean add(E o) {
        Lock lock = sync.writeLock();
        lock.lock();
        Set nextVersion = null;
        try {
            if (!current.set().contains(o)) {
                nextVersion = new Set(current);
                return nextVersion.set().add(o);
View Full Code Here

        }
    }

    public boolean remove(Object o) {
        Lock lock = sync.writeLock();
        lock.lock();
        Set nextVersion = null;
        try {
            if (current.set().contains(o)) {
                nextVersion = new Set(current);
                return nextVersion.set().remove(o);
View Full Code Here

        }
    }

    public Set<E> currentSet() {
        Lock lock = sync.readLock();
        lock.lock();
        try {
            return current;
        } finally {
            lock.unlock();
        }
View Full Code Here

            // as increment set the head revision in the read operation
            // (the read operation might see changes from other cluster nodes,
            // and so create a new head revision for the current cluster node,
            // to order revisions)
            Lock writeLock = backgroundOperationLock.writeLock();
            writeLock.lock();
            try {
                backgroundWrite();
                backgroundRead();
            } finally {
                writeLock.unlock();
View Full Code Here

        return update;
    }

    private Lock getAndLock(String key) {
        Lock l = locks.get(key);
        l.lock();
        return l;
    }

    @Override
    public void setReadWriteMode(String readWriteMode) {
View Full Code Here

    }
   
    @Override
    public <T extends Document> T find(Collection<T> collection, String key) {
        Lock lock = rwLock.readLock();
        lock.lock();
        try {
            ConcurrentSkipListMap<String, T> map = getMap(collection);
            return map.get(key);
        } finally {
            lock.unlock();
View Full Code Here

                                String toKey,
                                String indexedProperty,
                                long startValue,
                                int limit) {
        Lock lock = rwLock.readLock();
        lock.lock();
        try {
            ConcurrentSkipListMap<String, T> map = getMap(collection);
            ConcurrentNavigableMap<String, T> sub = map.subMap(fromKey + "\0", toKey);
            ArrayList<T> list = new ArrayList<T>();
            for (T doc : sub.values()) {
View Full Code Here

    }

    @Override
    public <T extends Document> void remove(Collection<T> collection, String path) {
        Lock lock = rwLock.writeLock();
        lock.lock();
        try {
            getMap(collection).remove(path);
        } finally {
            lock.unlock();
        }
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.