Search in sources :

Example 1 with PoolManagerGetPoolMonitor

use of diskCacheV111.vehicles.PoolManagerGetPoolMonitor in project dcache by dCache.

the class InstanceData method loadStorage.

private OptionalLong loadStorage() {
    PoolMonitor monitor;
    OptionalLong space = OptionalLong.empty();
    try {
        monitor = poolManagerStub.sendAndWait(new PoolManagerGetPoolMonitor(), 20000, CellEndpoint.SendFlag.RETRY_ON_NO_ROUTE_TO_CELL).getPoolMonitor();
        CostModule costModule = monitor.getCostModule();
        Collection<PoolCostInfo> costInfos = costModule.getPoolCostInfos();
        space = OptionalLong.of(costModule.getPoolCostInfos().stream().map(PoolCostInfo::getSpaceInfo).mapToLong(PoolCostInfo.PoolSpaceInfo::getTotalSpace).sum());
    } catch (CacheException | InterruptedException | NoRouteToCellException e) {
        LOGGER.error("Could not get storage information; set storage to -1.0. This was caused by: ", e);
    }
    return space;
}
Also used : CacheException(diskCacheV111.util.CacheException) CostModule(diskCacheV111.poolManager.CostModule) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException) OptionalLong(java.util.OptionalLong) PoolMonitor(org.dcache.poolmanager.PoolMonitor) PoolManagerGetPoolMonitor(diskCacheV111.vehicles.PoolManagerGetPoolMonitor) PoolManagerGetPoolMonitor(diskCacheV111.vehicles.PoolManagerGetPoolMonitor) PoolCostInfo(diskCacheV111.pools.PoolCostInfo)

Aggregations

CostModule (diskCacheV111.poolManager.CostModule)1 PoolCostInfo (diskCacheV111.pools.PoolCostInfo)1 CacheException (diskCacheV111.util.CacheException)1 PoolManagerGetPoolMonitor (diskCacheV111.vehicles.PoolManagerGetPoolMonitor)1 NoRouteToCellException (dmg.cells.nucleus.NoRouteToCellException)1 OptionalLong (java.util.OptionalLong)1 PoolMonitor (org.dcache.poolmanager.PoolMonitor)1