Code example for Lock

Methods: lock, unlock

0
        // idletime can be 0 or negative, no problem there 
        if (tunit == null) {
            throw new IllegalArgumentException("Time unit must not be null.");
        } 
 
        poolLock.lock();
        try { 
            idleConnHandler.closeIdleConnections(tunit.toMillis(idletime));
        } finally { 
            poolLock.unlock();
        } 
    } 
 
    public void closeExpiredConnections() { 
        poolLock.lock();
        try { 
            idleConnHandler.closeExpiredConnections();
        } finally { 
            poolLock.unlock();
        } 
    }