Search in sources :

Example 1 with MissingResourceCacheException

use of diskCacheV111.util.MissingResourceCacheException in project dcache by dCache.

the class PnfsManagerV3 method messageArrived.

public void messageArrived(CellMessage envelope, PnfsMessage message) throws CacheException {
    PnfsId pnfsId = message.getPnfsId();
    String path = message.getPnfsPath();
    int index;
    if (pnfsId != null) {
        index = (int) (Math.abs((long) pnfsId.hashCode()) % _threads);
        LOGGER.info("Using thread [{}] {}", pnfsId, index);
    } else if (path != null) {
        index = (int) (Math.abs((long) path.hashCode()) % _threads);
        LOGGER.info("Using thread [{}] {}", path, index);
    } else {
        index = _random.nextInt(_fifos.length);
        LOGGER.info("Using random thread {}", index);
    }
    /*
         * try to add a message into queue.
         * tell requester, that queue is full
         */
    if (!_fifos[index].offer(envelope)) {
        throw new MissingResourceCacheException("PnfsManager queue limit exceeded");
    }
}
Also used : MissingResourceCacheException(diskCacheV111.util.MissingResourceCacheException) PnfsId(diskCacheV111.util.PnfsId)

Aggregations

MissingResourceCacheException (diskCacheV111.util.MissingResourceCacheException)1 PnfsId (diskCacheV111.util.PnfsId)1