Search in sources :

Example 16 with Lock

use of java.util.concurrent.locks.Lock in project tomcat by apache.

the class StandardJarScanFilter method setTldScan.

public void setTldScan(String tldScan) {
    this.tldScan = tldScan;
    Lock writeLock = configurationLock.writeLock();
    writeLock.lock();
    try {
        populateSetFromAttribute(tldScan, tldScanSet);
    } finally {
        writeLock.unlock();
    }
}
Also used : Lock(java.util.concurrent.locks.Lock) ReentrantReadWriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) ReadWriteLock(java.util.concurrent.locks.ReadWriteLock)

Example 17 with Lock

use of java.util.concurrent.locks.Lock in project tomcat by apache.

the class StandardJarScanFilter method setTldSkip.

public void setTldSkip(String tldSkip) {
    this.tldSkip = tldSkip;
    Lock writeLock = configurationLock.writeLock();
    writeLock.lock();
    try {
        populateSetFromAttribute(tldSkip, tldSkipSet);
    } finally {
        writeLock.unlock();
    }
}
Also used : Lock(java.util.concurrent.locks.Lock) ReentrantReadWriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) ReadWriteLock(java.util.concurrent.locks.ReadWriteLock)

Example 18 with Lock

use of java.util.concurrent.locks.Lock in project tomcat by apache.

the class StandardJarScanFilter method check.

@Override
public boolean check(JarScanType jarScanType, String jarName) {
    Lock readLock = configurationLock.readLock();
    readLock.lock();
    try {
        final boolean defaultScan;
        final Set<String> toSkip;
        final Set<String> toScan;
        switch(jarScanType) {
            case TLD:
                {
                    defaultScan = defaultTldScan;
                    toSkip = tldSkipSet;
                    toScan = tldScanSet;
                    break;
                }
            case PLUGGABILITY:
                {
                    defaultScan = defaultPluggabilityScan;
                    toSkip = pluggabilitySkipSet;
                    toScan = pluggabilityScanSet;
                    break;
                }
            case OTHER:
            default:
                {
                    defaultScan = true;
                    toSkip = defaultSkipSet;
                    toScan = defaultScanSet;
                }
        }
        if (defaultScan) {
            if (Matcher.matchName(toSkip, jarName)) {
                if (Matcher.matchName(toScan, jarName)) {
                    return true;
                } else {
                    return false;
                }
            }
            return true;
        } else {
            if (Matcher.matchName(toScan, jarName)) {
                if (Matcher.matchName(toSkip, jarName)) {
                    return false;
                } else {
                    return true;
                }
            }
            return false;
        }
    } finally {
        readLock.unlock();
    }
}
Also used : Lock(java.util.concurrent.locks.Lock) ReentrantReadWriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) ReadWriteLock(java.util.concurrent.locks.ReadWriteLock)

Example 19 with Lock

use of java.util.concurrent.locks.Lock in project tomcat by apache.

the class ContainerBase method getClusterInternal.

/*
     * Provide access to just the cluster component attached to this container.
     */
protected Cluster getClusterInternal() {
    Lock readLock = clusterLock.readLock();
    readLock.lock();
    try {
        return cluster;
    } finally {
        readLock.unlock();
    }
}
Also used : ReadWriteLock(java.util.concurrent.locks.ReadWriteLock) ReentrantReadWriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) Lock(java.util.concurrent.locks.Lock)

Example 20 with Lock

use of java.util.concurrent.locks.Lock in project tomcat by apache.

the class ContainerBase method getRealm.

/**
     * Return the Realm with which this Container is associated.  If there is
     * no associated Realm, return the Realm associated with our parent
     * Container (if any); otherwise return <code>null</code>.
     */
@Override
public Realm getRealm() {
    Lock l = realmLock.readLock();
    l.lock();
    try {
        if (realm != null)
            return (realm);
        if (parent != null)
            return (parent.getRealm());
        return null;
    } finally {
        l.unlock();
    }
}
Also used : ReadWriteLock(java.util.concurrent.locks.ReadWriteLock) ReentrantReadWriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) Lock(java.util.concurrent.locks.Lock)

Aggregations

Lock (java.util.concurrent.locks.Lock)717 ReentrantReadWriteLock (java.util.concurrent.locks.ReentrantReadWriteLock)171 ReadWriteLock (java.util.concurrent.locks.ReadWriteLock)144 ReentrantLock (java.util.concurrent.locks.ReentrantLock)96 Test (org.junit.Test)57 ArrayList (java.util.ArrayList)41 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)36 IOException (java.io.IOException)33 CountDownLatch (java.util.concurrent.CountDownLatch)30 HashMap (java.util.HashMap)22 Triple (org.apache.clerezza.commons.rdf.Triple)21 Map (java.util.Map)20 Ignite (org.apache.ignite.Ignite)17 Condition (java.util.concurrent.locks.Condition)15 OSBTreeBonsaiLocalException (com.orientechnologies.orient.core.exception.OSBTreeBonsaiLocalException)13 OAtomicOperation (com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperation)13 HashSet (java.util.HashSet)13 BlankNodeOrIRI (org.apache.clerezza.commons.rdf.BlankNodeOrIRI)13 AtomicLong (java.util.concurrent.atomic.AtomicLong)12 OCacheEntry (com.orientechnologies.orient.core.storage.cache.OCacheEntry)11