コード例 #1
0
  private void printPoolDetails2(HFCPool pool, StringBuffer sb) {

    sb.append(pool._poolName);

    sb.append("\n").append(pool.toString()).append(" ");

    if (pool.cellInfo == null) {
      return;
    }

    PoolCellInfo cellInfo = pool.cellInfo;
    PoolCostInfo costInfo = cellInfo.getPoolCostInfo();
    PoolCostInfo.PoolSpaceInfo spaceInfo = costInfo.getSpaceInfo();
    PoolCostInfo.PoolQueueInfo queueInfo = costInfo.getStoreQueue();

    long total = spaceInfo.getTotalSpace();
    long precious = spaceInfo.getPreciousSpace();

    sb.append("   ")
        .append("Mode=")
        .append(pool.getPoolModeString())
        .append(";Total=")
        .append(total)
        .append(";Precious=")
        .append(precious)
        .append(";Frac=")
        .append((float) precious / (float) total)
        .append(";Queue={")
        .append(queueInfo.toString())
        .append("}\n");

    for (Object o : pool.flushInfos.values()) {

      HFCFlushInfo info = (HFCFlushInfo) o;
      StorageClassFlushInfo flush = info.getStorageClassFlushInfo();

      String storeName = flush.getStorageClass() + "@" + flush.getHsm();

      long size = flush.getTotalPendingFileSize();
      int count = flush.getRequestCount();
      int active = flush.getActiveCount();

      sb.append("   ")
          .append(storeName)
          .append("  ")
          .append(info._flushingRequested ? "R" : "-")
          .append(info._flushingPending ? "P" : "-")
          .append(info._flushingError != 0 ? "E" : "-")
          .append("(")
          .append(info._flushingId)
          .append(")")
          .append(";Size=")
          .append(size)
          .append(";Count=")
          .append(count)
          .append(";Active=")
          .append(active)
          .append("\n");
    }
  }
コード例 #2
0
 public HsmFlushControlCore.PoolDetails getDetails() {
   HsmFlushControllerPoolDetails details = new HsmFlushControllerPoolDetails();
   details._name = _poolName;
   details._isActive = isActive;
   details._isReadOnly = isReadOnly();
   details._cellInfo = cellInfo;
   details._flushInfos = new ArrayList<>();
   for (HFCFlushInfo info : flushInfos.values()) {
     details._flushInfos.add(info.getDetails());
   }
   return details;
 }
コード例 #3
0
  /////////////////////////////////////////////////////////////////////////////////////////
  //
  //      message arrived handler
  //
  private void poolFlushDoFlushMessageArrived(PoolFlushDoFlushMessage msg) {
    if (LOG_ENABLED) {
      _log.info("poolFlushDoFlushMessageArrived : " + msg);
    }
    String poolName = msg.getPoolName();
    synchronized (_poolCollector) {
      HFCPool pool = _poolCollector.getPoolByName(poolName);
      if (pool == null) {
        _log.warn(
            "poolFlushDoFlushMessageArrived : message arrived for non configured pool : "
                + poolName);
        return;
      }
      String storageClass = msg.getStorageClassName() + "@" + msg.getHsmName();
      HFCFlushInfo info = pool.flushInfos.get(storageClass);
      if (info == null) {
        _log.warn(
            "poolFlushDoFlushMessageArrived : message arrived for non existing storage class : "
                + storageClass);
        //
        // the real one doesn't exists anymore, so we simulate one.
        //
        info =
            new HFCFlushInfo(
                pool, new StorageClassFlushInfo(msg.getHsmName(), msg.getStorageClassName()));
      }
      if (msg.getReturnCode() != 0) {
        if (LOG_ENABLED) {
          _log.info("Flush failed (msg=" + (msg.isFinished() ? "Finished" : "Ack") + ") : " + msg);
        }

        info.setFlushingFailed(msg.getReturnCode(), msg.getErrorObject());
        //
        // maybe we have to call flushingDone here as well.
        //
        return;
      }
      if (msg.isFinished()) {
        if (LOG_ENABLED) {
          _log.info("Flush finished : " + msg);
        }

        updateFlushCellAndFlushInfos(msg, pool);
        info.setFlushingDone();
        _eventDispatcher.flushingDone(info);
      } else {
        info.setFlushingAck(msg.getFlushId());
      }
    }
  }
コード例 #4
0
  private void updateFlushCellAndFlushInfos(PoolFlushControlInfoMessage msg, HFCPool pool) {

    pool.cellInfo = msg.getCellInfo();
    StorageClassFlushInfo[] flushInfos = msg.getFlushInfos();
    HashMap<String, HFCFlushInfo> map = new HashMap<>();
    if (flushInfos != null) {
      for (StorageClassFlushInfo flushInfo : flushInfos) {
        String storageClass = flushInfo.getStorageClass() + "@" + flushInfo.getHsm();

        HFCFlushInfo info = pool.flushInfos.get(storageClass);
        if (info == null) {
          map.put(storageClass, new HFCFlushInfo(pool, flushInfo));
        } else {
          info.updateFlushInfo(flushInfo);
          map.put(storageClass, info);
        }
      }
    }
    pool.flushInfos = map;
    pool.isActive = true;
    pool.lastUpdated = System.currentTimeMillis();
    pool.answerCount++;
  }