/** * <P> * Creates an IPPollRange object that can be used to generate IPPollAddress * objects. The addresses are encapsulated by the range [start..end] and the * values of timeout and retry are set in each generated IPPollAddress * object. * </P> * * @param start * The start of the address range to cycle over. * @param end * The end of the address range to cycle over. * @param timeout * The timeout for each generated IPPollAddress. * @param retries * The number of retries for generated addresses. * * @see IPPollAddress * @see IPAddrRange * */ public IPPollRange(String foreignSource, String location, InetAddress start, InetAddress end, long timeout, int retries) { this(foreignSource, location, new IPAddrRange(start, end), timeout, retries); }
/** * <P> * Returns an Enumeration that can be used to cycle over the range of * pollable addresses. * </P> * * @return a {@link java.util.Enumeration} object. */ public Enumeration<IPPollAddress> elements() { return new IPPollRangeGenerator(m_range.elements()); }
protected static boolean isConsecutive(IPPollRange range, IPPollRange address) { Preconditions.checkState(BigInteger.ONE.equals(address.getAddressRange().size())); return range != null && new IPAddress(range.getAddressRange().getEnd()).isPredecessorOf(new IPAddress(address.getAddressRange().getEnd())) && Objects.equals(range.getForeignSource(), address.getForeignSource()) && Objects.equals(range.getLocation(), address.getLocation()) && range.getRetries() == address.getRetries() && range.getTimeout() == address.getTimeout(); }
for(IPPollRange range : job.getRanges()) { try { InetAddress begin = InetAddress.getByAddress(range.getAddressRange().getBegin()); InetAddress end = InetAddress.getByAddress(range.getAddressRange().getEnd()); builder.withRange(begin, end, range.getRetries(), range.getTimeout(), TimeUnit.MILLISECONDS); } catch (UnknownHostException e) {
previousRange.get().getAddressRange().incrementEnd(); return null;
protected static boolean isConsecutive(IPPollRange range, IPPollRange address) { Preconditions.checkState(BigInteger.ONE.equals(address.getAddressRange().size())); return range != null && new IPAddress(range.getAddressRange().getEnd()).isPredecessorOf(new IPAddress(address.getAddressRange().getEnd())) && Objects.equals(range.getForeignSource(), address.getForeignSource()) && Objects.equals(range.getLocation(), address.getLocation()) && range.getRetries() == address.getRetries() && range.getTimeout() == address.getTimeout(); }
for(IPPollRange range : job.getRanges()) { try { InetAddress begin = InetAddress.getByAddress(range.getAddressRange().getBegin()); InetAddress end = InetAddress.getByAddress(range.getAddressRange().getEnd()); builder.withRange(begin, end, range.getRetries(), range.getTimeout(), TimeUnit.MILLISECONDS); } catch (UnknownHostException e) {
previousRange.get().getAddressRange().incrementEnd(); return null;
/** * <P> * Returns an Iterator object that can be used to cycle over the range of * pollable address information. * </P> * * @return a {@link java.util.Iterator} object. */ @Override public Iterator<IPPollAddress> iterator() { return new IPPollRangeGenerator(m_range.elements()); }
/** * <P> * Creates an IPPollRange object that can be used to generate IPPollAddress * objects. The addresses are encapsulated by the range object and the * values of timeout and retry are set in each generated IPPollAddress * object. * </P> * * @param fromIP * The start of the address range to cycle over. * @param toIP * The end of the address range to cycle over. * @param timeout * The timeout for each generated IPPollAddress. * @param retries * The number of retries for generated addresses. * @see IPPollAddress * @see IPAddrRange * @throws java.net.UnknownHostException if any. */ public IPPollRange(String foreignSource, String location, String fromIP, String toIP, long timeout, int retries) throws java.net.UnknownHostException { m_range = new IPAddrRange(fromIP, toIP); m_foreignSource = foreignSource; m_location = location; m_timeout = timeout; m_retries = retries; }