Ejemplo n.º 1
0
  /**
   * getSpecifics
   *
   * @return a {@link java.util.List} object.
   */
  public List<IPPollAddress> getSpecifics() {
    final List<IPPollAddress> specifics = new LinkedList<IPPollAddress>();

    getReadLock().lock();
    try {
      Long defaultTimeout = null;
      Integer defaultRetries = null;
      if (getConfiguration().hasTimeout()) defaultTimeout = getConfiguration().getTimeout();
      if (getConfiguration().hasRetries()) defaultRetries = getConfiguration().getRetries();

      for (final Specific s : getConfiguration().getSpecificCollection()) {

        long timeout = 800L;
        if (s.hasTimeout()) {
          timeout = s.getTimeout();
        } else if (defaultTimeout != null) {
          timeout = defaultTimeout;
        }

        int retries = 3;
        if (s.hasRetries()) {
          retries = s.getRetries();
        } else if (defaultRetries != null) {
          retries = defaultRetries;
        }

        final String address = s.getContent();

        try {
          specifics.add(new IPPollAddress(InetAddressUtils.addr(address), timeout, retries));
        } catch (final IllegalArgumentException e) {
          LOG.warn("Failed to convert address {}", address, e);
        }
      }
      return specifics;
    } finally {
      getReadLock().unlock();
    }
  }
Ejemplo n.º 2
0
  /**
   * getSpecifics
   *
   * @return a {@link java.util.List} object.
   */
  public List<IPPollAddress> getSpecifics() {
    final List<IPPollAddress> specifics = new LinkedList<IPPollAddress>();

    getReadLock().lock();

    try {
      Long defaultTimeout = null;
      Integer defaultRetries = null;
      if (getConfiguration().hasTimeout()) defaultTimeout = getConfiguration().getTimeout();
      if (getConfiguration().hasRetries()) defaultRetries = getConfiguration().getRetries();

      for (final Specific s : getConfiguration().getSpecificCollection()) {

        long timeout = 800L;
        if (s.hasTimeout()) {
          timeout = s.getTimeout();
        } else if (defaultTimeout != null) {
          timeout = defaultTimeout;
        }

        int retries = 3;
        if (s.hasRetries()) {
          retries = s.getRetries();
        } else if (defaultRetries != null) {
          retries = defaultRetries;
        }

        try {
          specifics.add(new IPPollAddress(s.getContent(), timeout, retries));
        } catch (final UnknownHostException uhE) {
          LogUtils.warnf(this, uhE, "Failed to convert address %s", s.getContent());
        }
      }
      return specifics;
    } finally {
      getReadLock().unlock();
    }
  }