org.zstack.core.asyncbatch.While.each()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.zstack.core.asyncbatch.While.each()方法的一些代码示例,展示了While.each()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。While.each()方法的具体详情如下:
包路径:org.zstack.core.asyncbatch.While
类名称:While
方法名:each

While.each介绍

暂无

代码示例

代码示例来源:origin: zstackio/zstack

private void pingFilter(PrimaryStorageInventory inv, int count, int oneStepLimit, Completion completion){
  List<Integer> stepCount = new ArrayList<>();
  for(int i = 0; i <= count/oneStepLimit; i ++){
    stepCount.add(i);
  }
  List<ErrorCode> errs = new ArrayList<>();
  new While<>(stepCount).each((currentStep, compl) -> {
    pingFilterStep(inv, currentStep, oneStepLimit, new Completion(compl) {
      @Override
      public void success() {
        compl.allDone();
      }
      @Override
      public void fail(ErrorCode errorCode) {
        errs.add(errorCode);
        compl.done();
      }
    });
  }).run(new NoErrorCompletion(completion) {
    @Override
    public void done() {
      if(errs.size() == stepCount.size()){
        completion.fail(errs.get(0));
      }else {
        completion.success();
      }
    }
  });
}

代码示例来源:origin: zstackio/zstack

List<HostInventory> selectedHosts = new ArrayList<>();
List<ErrorCode> errs = new ArrayList<>();
new While<>(hosts).each((h, wcmpl) -> {
  reserveHost(h, new Completion(wcmpl) {
    @Override

代码示例来源:origin: zstackio/zstack

new While<>(ps).each((pvo, completion) -> {
  mount(PrimaryStorageInventory.valueOf(pvo), inv.getUuid(), new Completion(completion){

代码示例来源:origin: zstackio/zstack

new While<>(stepCount).each((currentStep, compl) -> pingHook(new Completion(compl) {
  @Override
  public void success() {

代码示例来源:origin: zstackio/zstack

@Override
  public void rollback(final FlowRollback chain, Map data) {
    VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString());
    List<DetachIpAddressFromVmNicMsg> msgs = new ArrayList<>();
    /* reload vmnic */
    List<VmNicVO> vmNicVOS = Q.New(VmNicVO.class).eq(VmNicVO_.vmInstanceUuid, spec.getVmInventory().getUuid()).list();
    for (VmNicVO nic : vmNicVOS) {
      List<String> ipUuids = VmNicHelper.getCanDetachL3List(VmNicInventory.valueOf(nic), spec.getL3Networks());
      for (String uuid : ipUuids) {
        DetachIpAddressFromVmNicMsg msg = new DetachIpAddressFromVmNicMsg();
        msg.setVmNicUuid(nic.getUuid());
        msg.setUsedIpUuid(uuid);
        bus.makeTargetServiceIdByResourceUuid(msg, VmInstanceConstant.SERVICE_ID, nic.getUuid());
        msgs.add(msg);
      }
    }

    new While<>(msgs).each((msg, comp) -> bus.send(msg, new CloudBusCallBack(comp) {
      @Override
      public void run(MessageReply reply) {
        comp.done();
      }
    })).run(new NoErrorCompletion(chain) {
      @Override
      public void done() {
        chain.rollback();
      }
    });
  }
}

代码示例来源:origin: zstackio/zstack

new While<>(msgs).each((msg, comp) -> bus.send(msg, new CloudBusCallBack(comp) {
  @Override
  public void run(MessageReply reply) {

代码示例来源:origin: zstackio/zstack

new While<>(firstL3s).each((nw, wcomp) -> {
  int deviceId = deviceIdBitmap.nextClearBit(0);
  deviceIdBitmap.set(deviceId);

代码示例来源:origin: zstackio/zstack

private void applianceVmsCascadeDeleteAdditionPubclicNic(List<VmNicInventory> toDeleteNics) {
  ErrorCodeList errList = new ErrorCodeList();
  FutureCompletion completion = new FutureCompletion(null);
  new While<>(toDeleteNics).each((VmNicInventory nic, WhileCompletion completion1) -> {
    if (!dbf.isExist(nic.getUuid(), VmNicVO.class)) {
      logger.debug(String.format("nic[uuid:%s] not exists, skip", nic.getUuid()));

代码示例来源:origin: zstackio/zstack

private void doPing(List<String> hostUuids, PrimaryStorageInventory psInv, Completion completion){
  List<ErrorCode> errs = new ArrayList<>();
  new While<>(hostUuids).each((huuid, compl) -> {
    PingCmd cmd = new PingCmd();
    cmd.setUuid(psInv.getUuid());

代码示例来源:origin: zstackio/zstack

private void rollbackCertificate(VirtualRouterVmInventory vr, List<LoadBalancerStruct> struct, final NoErrorCompletion completion){
  Set<String> certificateUuids = getCertificates(struct);
  new While<>(certificateUuids).each((uuid, wcmpl) -> {
    VirtualRouterAsyncHttpCallMsg msg = new VirtualRouterAsyncHttpCallMsg();
    msg.setVmInstanceUuid(vr.getUuid());
    msg.setPath(DELETE_CERTIFICATE_PATH);
    CertificateCmd cmd = new CertificateCmd();
    cmd.setUuid(uuid);
    msg.setCommand(cmd);
    bus.makeTargetServiceIdByResourceUuid(msg, VmInstanceConstant.SERVICE_ID, vr.getUuid());
    bus.send(msg, new CloudBusCallBack(wcmpl) {
      @Override
      public void run(MessageReply reply) {
        wcmpl.done();
      }
    });
  }).run(new NoErrorCompletion(completion) {
    @Override
    public void done() {
      completion.done();
    }
  });
}

代码示例来源:origin: zstackio/zstack

new While<>(certificateUuids).each((uuid, wcmpl) -> {
  VirtualRouterAsyncHttpCallMsg msg = new VirtualRouterAsyncHttpCallMsg();
  msg.setVmInstanceUuid(vr.getUuid());

代码示例来源:origin: zstackio/zstack

new While<>(forwardDnsStructs).each((forwardDnsStruct, whileComplection) -> {
  VirtualRouterStruct s = new VirtualRouterStruct();
  s.setL3Network(forwardDnsStruct.getL3Network());

代码示例来源:origin: zstackio/zstack

new While<>(forwardDnsStructs).each((forwardDnsStruct, whileComplection) -> {
  VirtualRouterCommands.RemoveForwardDnsCmd cmd = new VirtualRouterCommands.RemoveForwardDnsCmd();
  cmd.setMac(forwardDnsStruct.getMac());

相关文章