use of diskCacheV111.vehicles.PoolMoverKillMessage in project dcache by dCache.
the class XrootdDoor method messageArrived.
/**
* Requests to start movers are processed synchronously by the Transfer class. This message
* handler will only ever receive replies for those requests for which the Transfer class timed
* out or interrupted.
* <p>
* To avoid that orphaned movers fill a transfer slot on the pool, we kill it right away.
*/
public void messageArrived(PoolIoFileMessage message) {
if (message.getReturnCode() == 0) {
String pool = message.getPoolName();
_poolStub.notify(new CellPath(pool), new PoolMoverKillMessage(pool, message.getMoverId(), "door timed out before pool"));
}
}
use of diskCacheV111.vehicles.PoolMoverKillMessage in project dcache by dCache.
the class TransferManagerHandler method killMover.
public void killMover(int moverId, String explanation) {
LOGGER.debug("sending mover kill to pool {} for moverId={}", pool, moverId);
PoolMoverKillMessage killMessage = new PoolMoverKillMessage(pool.getName(), moverId, "killed by TransferManagerHandler: " + explanation);
killMessage.setReplyRequired(false);
manager.getPoolStub().notify(new CellPath(pool.getAddress()), killMessage);
}
use of diskCacheV111.vehicles.PoolMoverKillMessage in project dcache by dCache.
the class Transfer method killMover.
/**
* Kills the mover of the transfer. Blocks until the mover has died or until a timeout is
* reached. An error is logged if the mover failed to die or if the timeout was reached.
*
* @param millis Timeout in milliseconds
* @param explanation short information why the transfer is killed
*/
public void killMover(long millis, String explanation) {
if (!hasMover()) {
return;
}
Integer moverId = getMoverId();
Pool pool = getPool();
setStatus("Mover " + pool + "/" + moverId + ": Killing mover");
try {
/* Kill the mover.
*/
PoolMoverKillMessage message = new PoolMoverKillMessage(pool.getName(), moverId, explanation);
message.setReplyRequired(false);
_poolStub.notify(new CellPath(pool.getAddress()), message);
/* To reduce the risk of orphans when using PNFS, we wait
* for the transfer confirmation.
*/
if (millis > 0 && !waitForMover(millis)) {
_log.error("Failed to kill mover {}/{}: Timeout", pool, moverId);
}
} catch (CacheException e) {
// Not surprising that the pool reported a failure
// when we killed the mover.
_log.debug("Killed mover and pool reported: {}", e.getMessage());
} catch (InterruptedException e) {
_log.warn("Failed to kill mover {}/{}: {}", pool, moverId, e.getMessage());
Thread.currentThread().interrupt();
} finally {
setStatus(null);
}
}
use of diskCacheV111.vehicles.PoolMoverKillMessage in project dcache by dCache.
the class DcacheResourceFactory method messageArrived.
/**
* Fall back message handler for mover creation replies. We only receive these if the Transfer
* timed out before the mover was created. Instead we kill the mover.
*/
public void messageArrived(PoolIoFileMessage message) {
if (message.getReturnCode() == 0) {
String pool = message.getPoolName();
_poolStub.notify(new CellPath(pool), new PoolMoverKillMessage(pool, message.getMoverId(), "door timed out before pool"));
}
}
use of diskCacheV111.vehicles.PoolMoverKillMessage in project dcache by dCache.
the class PoolInfoResources method killMovers.
@DELETE
@ApiOperation("Kill a mover. Requires admin role.")
@ApiResponses({ @ApiResponse(code = 400, message = "Bad Request"), @ApiResponse(code = 403, message = "Pool command only accessible to admin users."), @ApiResponse(code = 500, message = "Internal Server Error") })
@Path("/{pool}/movers/{id : [0-9]+}")
@Produces(MediaType.APPLICATION_JSON)
public Response killMovers(@ApiParam(value = "The pool with the mover to be killed.", required = true) @PathParam("pool") String pool, @ApiParam(value = "The id of the mover to be killed.", required = true) @PathParam("id") int id) {
if (!RequestUser.isAdmin()) {
throw new ForbiddenException("Pool command only accessible to admin users.");
}
try {
poolStub.sendAndWait(new CellPath(pool), new PoolMoverKillMessage(pool, id, "Killed by user."));
transferInfoService.setCancelled(pool, id);
} catch (IllegalArgumentException e) {
throw new BadRequestException(e);
} catch (CacheException e) {
if (e.getRc() == CacheException.MOVER_NOT_FOUND) {
transferInfoService.setCancelled(pool, id);
} else {
LOGGER.warn(Exceptions.meaningfulMessage(e));
throw new InternalServerErrorException(e);
}
} catch (InterruptedException | NoRouteToCellException e) {
LOGGER.warn(Exceptions.meaningfulMessage(e));
throw new InternalServerErrorException(e);
}
return successfulResponse(Response.Status.OK);
}
Aggregations