Search in sources :

Example 1 with RemoveReplicaMessage

use of org.dcache.vehicles.resilience.RemoveReplicaMessage in project dcache by dCache.

the class FileOperationHandler method removeTarget.

/**
 * <p>Synchronously removes from the target location the cache entry of the
 * pnfsid associated with this task.  This is done via a message sent to a handler for this
 * purpose on the pool itself.</p>
 */
private void removeTarget(PnfsId pnfsId, String target) throws CacheException {
    RemoveReplicaMessage msg = new RemoveReplicaMessage(target, pnfsId);
    LOGGER.trace("Sending RemoveReplicasMessage {}.", msg);
    ACTIVITY_LOGGER.info("Removing {} from {}", pnfsId, target);
    Future<RemoveReplicaMessage> future = pools.send(new CellPath(target), msg);
    try {
        msg = future.get();
        LOGGER.trace("Returned ReplicationRepRmMessage {}.", msg);
    } catch (InterruptedException | ExecutionException e) {
        throw CacheExceptionUtils.getCacheException(CacheException.SELECTED_POOL_FAILED, FileTaskCompletionHandler.FAILED_REMOVE_MESSAGE, pnfsId, Type.REMOVE, target, e);
    }
    CacheException exception = msg.getErrorObject() == null ? null : CacheExceptionFactory.exceptionOf(msg);
    if (exception != null && !CacheExceptionUtils.replicaNotFound(exception)) {
        throw CacheExceptionUtils.getCacheException(CacheException.SELECTED_POOL_FAILED, FileTaskCompletionHandler.FAILED_REMOVE_MESSAGE, pnfsId, Type.REMOVE, target, exception);
    }
}
Also used : CellPath(dmg.cells.nucleus.CellPath) CacheException(diskCacheV111.util.CacheException) ExecutionException(java.util.concurrent.ExecutionException) RemoveReplicaMessage(org.dcache.vehicles.resilience.RemoveReplicaMessage)

Aggregations

CacheException (diskCacheV111.util.CacheException)1 CellPath (dmg.cells.nucleus.CellPath)1 ExecutionException (java.util.concurrent.ExecutionException)1 RemoveReplicaMessage (org.dcache.vehicles.resilience.RemoveReplicaMessage)1