@Transactional
 private void handle(TakePrimaryStorageCapacityMsg msg) {
   PrimaryStorageCapacityVO vo =
       dbf.getEntityManager()
           .find(PrimaryStorageCapacityVO.class, self.getUuid(), LockModeType.PESSIMISTIC_WRITE);
   vo.setAvailableCapacity(vo.getAvailableCapacity() - msg.getSize());
   if (vo.getAvailableCapacity() < 0) {
     vo.setAvailableCapacity(0);
   }
   dbf.getEntityManager().merge(vo);
   TakePrimaryStorageCapacityReply reply = new TakePrimaryStorageCapacityReply();
   bus.reply(msg, reply);
 }
  @Transactional
  private void handle(PrimaryStorageReportCapacityMsg msg) {
    PrimaryStorageCapacityVO vo =
        dbf.getEntityManager()
            .find(PrimaryStorageCapacityVO.class, self.getUuid(), LockModeType.PESSIMISTIC_WRITE);
    if (vo.getTotalCapacity() == 0) {
      vo.setTotalCapacity(msg.getTotalCapacity());
      vo.setAvailableCapacity(msg.getAvailableCapacity());
      dbf.getEntityManager().merge(vo);
    }

    PrimaryStorageReportCapacityReply reply = new PrimaryStorageReportCapacityReply();
    bus.reply(msg, reply);
  }