Examples of PingResult


Examples of net.azib.ipscan.core.net.PingResult

  protected PingResult executePing(ScanningSubject subject) {
    if (subject.hasParameter(PARAMETER_PING_RESULT))
      return (PingResult) subject.getParameter(PARAMETER_PING_RESULT);

    PingResult result;
    try {
      result = pinger.ping(subject, config.pingCount);
    }
    catch (IOException e) {
      // if this is not a timeout
      LOG.log(Level.WARNING, "Pinging failed", e);
      // return an empty ping result
      result = new PingResult(subject.getAddress());
    }
    // remember the result for other fetchers to use
    subject.setParameter(PARAMETER_PING_RESULT, result);
    return result;
  }
View Full Code Here

Examples of net.azib.ipscan.core.net.PingResult

    subject.setParameter(PARAMETER_PING_RESULT, result);
    return result;
  }

  public Object scan(ScanningSubject subject) {
    PingResult result = executePing(subject);
    subject.setResultType(result.isAlive() ? ResultType.ALIVE : ResultType.DEAD);
   
    if (!result.isAlive() && !config.scanDeadHosts) {
      // the host is dead, we are not going to continue...
      subject.abortAddressScanning();
    }
   
    return result.isAlive() ? new IntegerWithUnit(result.getAverageTime(), "ms") : null;
  }
View Full Code Here

Examples of net.azib.ipscan.core.net.PingResult

  public String getId() {
    return "fetcher.ping.ttl";
  }

  public Object scan(ScanningSubject subject) {
    PingResult result = executePing(subject);
    subject.setResultType(result.isAlive() ? ResultType.ALIVE : ResultType.DEAD);
    return result.isAlive() && result.getTTL() > 0 ? result.getTTL() : null;
  }
View Full Code Here

Examples of net.azib.ipscan.core.net.PingResult

    config = mock(ScannerConfig.class);
    subject = new ScanningSubject(null);
    subject.config = config;
    config.portTimeout = 1000;
    config.adaptPortTimeout = true;
    pingResult = new PingResult(null);
    subject.setParameter(ScanningSubject.PARAMETER_PING_RESULT, pingResult);
  }
View Full Code Here

Examples of net.azib.ipscan.core.net.PingResult

    // see if it is already computed
    if (adaptedPortTimeout > 0)
      return adaptedPortTimeout;
   
    // try to adapt timeout if it is enabled and pinging results are available
    PingResult pingResult = (PingResult) getParameter(PARAMETER_PING_RESULT);
    if (pingResult != null) {
      if (config.adaptPortTimeout && pingResult.isTimeoutAdaptationAllowed()) {
        adaptedPortTimeout = Math.min(Math.max(pingResult.getLongestTime() * 3, config.minPortTimeout), config.portTimeout);
        return adaptedPortTimeout;
      }
    }
    // if no pinging results are available yet, return the full timeout
    return config.portTimeout;
View Full Code Here

Examples of org.exoplatform.services.remote.group.PingResult

         throw new Exception("Cannot find the member: " + member.getIpAddress());
      Message pingMesg = createMessage(PingMessageHandler.IDENTIFIER);
      pingMesg.setMessage(message);
      org.jgroups.Message jmessage = new org.jgroups.Message(dest, null, pingMesg);
      Object result = mdispatcher_.sendMessage(jmessage, GroupRequest.GET_ALL, 0);
      PingResult p = new PingResult(member, (String)result);
      return p;
   }
View Full Code Here

Examples of org.exoplatform.services.remote.group.PingResult

      RspList res = mdispatcher_.castMessage(null, jmessage, GroupRequest.GET_ALL, 0);
      List results = new ArrayList();
      for (int i = 0; i < res.size(); i++)
      {
         Rsp rsp = (Rsp)res.elementAt(i);
         PingResult result = new PingResult(Util.createMemberInfo(rsp.getSender()), (String)rsp.getValue());
         results.add(result);
      }
      return results;
   }
View Full Code Here

Examples of org.exoplatform.services.remote.group.PingResult

         throw new Exception("Cannot find the member: " + member.getIpAddress());
      Message pingMesg = createMessage(PingMessageHandler.IDENTIFIER);
      pingMesg.setMessage(message);
      org.jgroups.Message jmessage = new org.jgroups.Message(dest, null, pingMesg);
      Object result = mdispatcher_.sendMessage(jmessage, GroupRequest.GET_ALL, 0);
      PingResult p = new PingResult(member, (String)result);
      return p;
   }
View Full Code Here

Examples of org.exoplatform.services.remote.group.PingResult

      RspList res = mdispatcher_.castMessage(null, jmessage, GroupRequest.GET_ALL, 0);
      List results = new ArrayList();
      for (int i = 0; i < res.size(); i++)
      {
         Rsp rsp = (Rsp)res.elementAt(i);
         PingResult result = new PingResult(Util.createMemberInfo(rsp.getSender()), (String)rsp.getValue());
         results.add(result);
      }
      return results;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.