Package com.iisigroup.cap.hg.service

Examples of com.iisigroup.cap.hg.service.IHGService


   */
  @Override
  public void execute() throws CapException {
    List<IHGService> rService = new ArrayList<IHGService>();
    List<IHGService> nrService = new ArrayList<IHGService>();
    IHGService ts;
    long startTime = System.currentTimeMillis();
    for (ActionBean s : services) {
      ts = s.getService();
      int rt = s.getTimeout();
      if (s.isRequired()) {
        if (rt > rTimeout) {
          rTimeout = rt;
        }
        rService.add(ts);
      } else {
        if (rt > nrTimeout) {
          nrTimeout = rt;
        }
        nrService.add(ts);
      }
      //ts.setProperty(MCIConstants.TXNCD, getTxnCd());
      ts.setSendData(getSendData());
      ts.initConnection();
      try {
        ts.execute();
      } catch (CapException e) {
        throw e;
      } catch (Exception e) {
        throw new CapException(e, e.getClass());
      }
    }
    executeService(startTime, rService, rTimeout);
    executeService(startTime, nrService, nrTimeout);
    // merge data
    resultData = null;
    for (ActionBean s : services) {
      ts = s.getService();
      if (s.getResponseAction() != null) {
        resultData = s.getResponseAction().margeResponse(resultData, ts.getReceiveData());
      } else if (resultData == null) {
        resultData = ts.getReceiveData();
      }
    }
  }
View Full Code Here


      }
    }
  }

  private void executeService(long startTime, List<IHGService> service, int timeout) throws CapException {
    IHGService s;
    while (true) {
      for (int i = service.size() - 1; i >= 0; i--) {
        s = service.get(i);
        if (!ConnStatusEnum.RUNNING.equals(s.getStatus())) {
          service.remove(s);
        }
      }
      if (service.isEmpty() || System.currentTimeMillis() - startTime >= timeout) {
        for (IHGService s2 : service) {
View Full Code Here

TOP

Related Classes of com.iisigroup.cap.hg.service.IHGService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.