use of org.dcache.cells.MessageReply in project dcache by dCache.
the class QoSMessageHandler method messageArrived.
/**
* Returns whether replica exists, the status of its system sticky flag and whether its state
* allows for reading and removal.
*/
public Reply messageArrived(ReplicaStatusMessage message) {
MessageReply<Message> reply = new MessageReply<>();
executor.execute(() -> {
PnfsId pnfsId = message.getPnfsId();
try {
CacheEntry entry = repository.getEntry(pnfsId);
message.setExists(true);
switch(entry.getState()) {
case FROM_CLIENT:
case FROM_POOL:
case FROM_STORE:
message.setWaiting(true);
break;
case CACHED:
message.setReadable(true);
message.setRemovable(true);
break;
case BROKEN:
message.setBroken(true);
message.setRemovable(true);
break;
case PRECIOUS:
message.setReadable(true);
message.setPrecious(true);
break;
default:
break;
}
Collection<StickyRecord> records = entry.getStickyRecords();
for (StickyRecord record : records) {
if (record.owner().equals(SYSTEM_OWNER) && record.isNonExpiring()) {
message.setSystemSticky(true);
break;
}
}
reply.reply(message);
} catch (FileNotInCacheException e) {
reply.reply(message);
} catch (Exception e) {
reply.fail(message, e);
}
});
return reply;
}
use of org.dcache.cells.MessageReply in project dcache by dCache.
the class ResilienceMessageHandler method messageArrived.
/**
* <p>Returns whether replica exists, the status of its system sticky flag
* and whether its state allows for reading and removal.</p>
*/
public Reply messageArrived(ReplicaStatusMessage message) {
MessageReply<Message> reply = new MessageReply<>();
executor.execute(() -> {
PnfsId pnfsId = message.getPnfsId();
if (pnfsId == null) {
reply.fail(message, new IllegalArgumentException("no pnfsid"));
return;
}
try {
CacheEntry entry = repository.getEntry(pnfsId);
message.setExists(true);
switch(entry.getState()) {
case FROM_CLIENT:
case FROM_POOL:
case FROM_STORE:
message.setWaiting(true);
break;
case CACHED:
message.setReadable(true);
message.setRemovable(true);
break;
case BROKEN:
message.setBroken(true);
message.setRemovable(true);
break;
case PRECIOUS:
message.setReadable(true);
break;
default:
break;
}
Collection<StickyRecord> records = entry.getStickyRecords();
for (StickyRecord record : records) {
if (record.owner().equals(SYSTEM_OWNER) && record.isNonExpiring()) {
message.setSystemSticky(true);
break;
}
}
reply.reply(message);
} catch (FileNotInCacheException e) {
reply.reply(message);
} catch (Exception e) {
reply.fail(message, e);
}
});
return reply;
}
use of org.dcache.cells.MessageReply in project dcache by dCache.
the class PoolInfoRequestHandler method messageArrived.
/**
* <p>Gathers diagnostic and detail information about various
* cell components for the pool, including migration jobs.</p>
*/
public Reply messageArrived(PoolDataRequestMessage message) {
MessageReply<Message> reply = new MessageReply<>();
executor.execute(() -> {
try {
PoolData request = new PoolData();
request.setCellData(getCellInfoRequest());
request.setDetailsData(pool.getDataObject());
request.setCsmData(checksumModule.getDataObject());
request.setFlushData(flushController.getDataObject());
request.setHsmFlushQMData(hsmFlushQueueManager.getDataObject());
request.setJtmData(jobTimeoutManager.getDataObject());
MigrationData client = migrationClient.getDataObject();
MigrationData service = migrationServer.getDataObject();
client.setServerRequests(service.getServerRequests());
request.setMigrationData(client);
request.setPpData(p2pClient.getDataObject());
request.setRepositoryData(repositoryProvider.getDataObject());
request.setStorageHandlerData(storageHandler.getDataObject());
request.setTransferServicesData(transferServices.getDataObject());
request.setSpaceByStorageUnit(statisticsListener.toJson());
message.setData(request);
reply.reply(message);
} catch (Exception e) {
reply.fail(message, handleRuntimeException(e));
}
});
return reply;
}
use of org.dcache.cells.MessageReply in project dcache by dCache.
the class PoolInfoRequestHandler method messageArrived.
/**
* <p>Gets cache information from the repository for a given pnfsid.</p>
*/
public Reply messageArrived(CacheEntryInfoMessage message) {
MessageReply<Message> reply = new MessageReply<>();
executor.execute(() -> {
try {
PnfsId pnfsId = message.getPnfsId();
message.setRepositoryListing(repository.getEntry(pnfsId).toString());
message.setInfo(pool.getCacheRepositoryEntryInfo(message.getPnfsId()));
reply.reply(message);
} catch (Exception e) {
reply.fail(message, handleRuntimeException(e));
}
});
return reply;
}
use of org.dcache.cells.MessageReply in project dcache by dCache.
the class PoolInfoRequestHandler method messageArrived.
public Reply messageArrived(PoolLiveDataForHistoriesMessage message) {
MessageReply<Message> reply = new MessageReply<>();
executor.execute(() -> {
try {
message.setPoolCostData(new PoolCostData(pool.getPoolCostInfo()));
/*
* NB: sweeper data is obtained by the history service
* on behalf of the pool service on the frontend.
*/
message.setSweeperData(sweeper.getDataObject());
reply.reply(message);
} catch (Exception e) {
reply.fail(message, handleRuntimeException(e));
}
});
return reply;
}
Aggregations