Examples of RWLock


Examples of com.pcmsolutions.util.RWLock

    public void lockSampleRead(SampleContext sc, Integer sample) throws NoSuchSampleException, NoSuchContextException {
        if (sc == null)
            throw new NoSuchContextException();

        RWLock pLock = (RWLock) s2sl.get(sample);

        if (pLock != null)
            pLock.read();
        else
            throw new NoSuchSampleException(sample);
    }
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

    public boolean tryLockSampleRead(SampleContext sc, Integer sample) throws NoSuchSampleException, NoSuchContextException {
        if (sc == null)
            throw new NoSuchContextException();

        RWLock pLock = (RWLock) s2sl.get(sample);
        if (pLock != null) {
            return pLock.tryRead();
        } else
            throw new NoSuchSampleException(sample);
    }
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

            throw new NoSuchContextException();

        if (s2sc.get(sample) != sc)
            lockSampleWrite(getParent(sc), sample);
        else {
            RWLock pLock = (RWLock) s2sl.get(sample);
            if (pLock != null)
                pLock.write();
            else
                throw new NoSuchSampleException(sample);
        }
    }
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

            throw new NoSuchContextException();

        if (s2sc.get(sample) != sc)
            return tryLockSampleWrite(getParent(sc), sample);
        else {
            RWLock pLock = (RWLock) s2sl.get(sample);
            if (pLock != null) {
                return pLock.tryWrite();
            } else
                throw new NoSuchSampleException(sample);
        }
    }
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

    public boolean isSampleWriteLocked(SampleContext sc, Integer sample) throws NoSuchSampleException, NoSuchContextException {
        if (s2sc.get(sample) != sc || sc == null)
            throw new NoSuchContextException();

        RWLock pLock = (RWLock) s2sl.get(sample);
        if (pLock == null)
            throw new NoSuchSampleException(sample);
        return pLock.isWriteLocked();
    }
View Full Code Here

Examples of com.sun.media.jai.util.RWLock

    public ThreadSafeOperationRegistry() {
  super();

  // Create an upgradable reader/writer lock.
  lock = new RWLock(true);
    }
View Full Code Here

Examples of com.sun.media.jai.util.RWLock

/*     */ {
/*     */   private RWLock lock;
/*     */
/*     */   public ThreadSafeOperationRegistry()
/*     */   {
/*  49 */     this.lock = new RWLock(true);
/*     */   }
View Full Code Here

Examples of marauroa.server.RWLock

  protected PlayerEntryContainer() {
    /* Initialize the random number generator */
    rand = new Random();
    rand.setSeed(new Date().getTime());

    lock = new RWLock();

    /* We initialize the list that will help us sort the player entries. */
    clientidMap = Collections.synchronizedMap(new HashMap<Integer, PlayerEntry>());
  }
View Full Code Here

Examples of one.nio.lock.RWLock

    public boolean putIfAbsent(K key, V value) {
        long hashCode = hashCode(key);
        long currentPtr = bucketFor(hashCode);

        RWLock lock = lockFor(hashCode).lockWrite();
        try {
            for (long entry; (entry = unsafe.getAddress(currentPtr)) != 0; currentPtr = entry + NEXT_OFFSET) {
                if (unsafe.getLong(entry + HASH_OFFSET) == hashCode && equalsAt(entry, key)) {
                    return false;
                }
            }

            long entry = allocateEntry(key, hashCode, sizeOf(value));
            unsafe.putLong(entry + HASH_OFFSET, hashCode);
            unsafe.putAddress(entry + NEXT_OFFSET, 0);
            setTimeAt(entry);
            setValueAt(entry, value);

            unsafe.putAddress(currentPtr, entry);
        } finally {
            lock.unlockWrite();
        }

        count.incrementAndGet();
        return true;
    }
View Full Code Here

Examples of one.nio.lock.RWLock

    public boolean remove(K key) {
        long hashCode = hashCode(key);
        long currentPtr = bucketFor(hashCode);
        long entry;

        RWLock lock = lockFor(hashCode).lockWrite();
        try {
            for (;;) {
                if ((entry = unsafe.getAddress(currentPtr)) == 0) {
                    return false;
                }
                if (unsafe.getLong(entry + HASH_OFFSET) == hashCode && equalsAt(entry, key)) {
                    unsafe.putAddress(currentPtr, unsafe.getAddress(entry + NEXT_OFFSET));
                    break;
                }
                currentPtr = entry + NEXT_OFFSET;
            }
        } finally {
            lock.unlockWrite();
        }

        destroyEntry(entry);
        count.decrementAndGet();
        return true;
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.