Search in sources :

Example 1 with ChangeStickyBitMessage

use of org.dcache.vehicles.qos.ChangeStickyBitMessage in project dcache by dCache.

the class ReplicaStateAdjuster method sendMessageToRepository.

private synchronized void sendMessageToRepository() {
    Message msg;
    switch(action) {
        case UNSET_PRECIOUS_REPLICA:
            msg = new ChangePreciousBitMessage(target, pnfsId);
            break;
        case PERSIST_REPLICA:
            msg = new ChangeStickyBitMessage(target, pnfsId, true);
            break;
        case CACHE_REPLICA:
            msg = new ChangeStickyBitMessage(target, pnfsId, false);
            break;
        default:
            throw new RuntimeException("ReplicaStateAdjuster does not handle " + action + "; this is a bug.");
    }
    LOGGER.debug("Sending {} message to {} for {}.", action, target, pnfsId);
    ACTIVITY_LOGGER.info("Sending {} message to {} for {}.", action, target, pnfsId);
    future = pools.send(new CellPath(target), msg);
}
Also used : CellPath(dmg.cells.nucleus.CellPath) ChangePreciousBitMessage(org.dcache.vehicles.qos.ChangePreciousBitMessage) ChangeStickyBitMessage(org.dcache.vehicles.qos.ChangeStickyBitMessage) ChangePreciousBitMessage(org.dcache.vehicles.qos.ChangePreciousBitMessage) Message(diskCacheV111.vehicles.Message) ChangeStickyBitMessage(org.dcache.vehicles.qos.ChangeStickyBitMessage)

Example 2 with ChangeStickyBitMessage

use of org.dcache.vehicles.qos.ChangeStickyBitMessage in project dcache by dCache.

the class QoSMessageHandler method messageArrived.

public Reply messageArrived(ChangeStickyBitMessage message) {
    long expiry = message.isSticky() ? StickyRecord.NON_EXPIRING : 0L;
    PnfsId pnfsId = message.getPnfsId();
    MessageReply<Message> reply = new MessageReply<>();
    executor.execute(() -> {
        try {
            repository.setSticky(pnfsId, SYSTEM_OWNER, expiry, true);
            reply.reply(message);
        } catch (Exception e) {
            reply.fail(message, e);
        }
    });
    return reply;
}
Also used : ChangePreciousBitMessage(org.dcache.vehicles.qos.ChangePreciousBitMessage) Message(diskCacheV111.vehicles.Message) ChangeStickyBitMessage(org.dcache.vehicles.qos.ChangeStickyBitMessage) ReplicaStatusMessage(org.dcache.vehicles.qos.ReplicaStatusMessage) MessageReply(org.dcache.cells.MessageReply) PnfsId(diskCacheV111.util.PnfsId) FileNotInCacheException(diskCacheV111.util.FileNotInCacheException)

Aggregations

Message (diskCacheV111.vehicles.Message)2 ChangePreciousBitMessage (org.dcache.vehicles.qos.ChangePreciousBitMessage)2 ChangeStickyBitMessage (org.dcache.vehicles.qos.ChangeStickyBitMessage)2 FileNotInCacheException (diskCacheV111.util.FileNotInCacheException)1 PnfsId (diskCacheV111.util.PnfsId)1 CellPath (dmg.cells.nucleus.CellPath)1 MessageReply (org.dcache.cells.MessageReply)1 ReplicaStatusMessage (org.dcache.vehicles.qos.ReplicaStatusMessage)1