@Override public void handleError(InetAddress address, EchoPacket request, Throwable t) { Map<String, String> mdc = getCopyOfContextMap(); try { setContextMap(m_mdc); m_cb.handleError(address, request, t); } finally { setContextMap(mdc); } }
@Override public void handleResponse(InetAddress address, EchoPacket response) { Map<String, String> mdc = getCopyOfContextMap(); try { setContextMap(m_mdc); m_cb.handleResponse(address, response); } finally { setContextMap(mdc); } }
@Override public void handleTimeout(InetAddress address, EchoPacket request) { Map<String, String> mdc = getCopyOfContextMap(); try { setContextMap(m_mdc); m_cb.handleTimeout(address, request); } finally { setContextMap(mdc); } } }
/** {@inheritDoc} */ @Override public void handleResponse(InetAddress address, EchoPacket response) { try { info("got response for address " + address + ", thread " + response.getIdentifier() + ", seq " + response.getSequenceNumber() + " with a responseTime "+response.elapsedTime(TimeUnit.MILLISECONDS)+"ms"); m_responseTime = (long)Math.round(response.elapsedTime(TimeUnit.MICROSECONDS)); } finally { m_latch.countDown(); } }
/** {@inheritDoc} */ @Override public void handleTimeout(InetAddress address, EchoPacket request) { try { assert(request != null); info("timed out pinging address " + address + ", thread " + request.getIdentifier() + ", seq " + request.getSequenceNumber()); } finally { m_latch.countDown(); } }
@Override public int getSequenceNumber() { return m_packet.getSequenceNumber(); }
/** * <p>sendRequest</p> * * @param request a {@link org.opennms.netmgt.ping.PingRequest} object. */ @Override public void sendRequest(PingRequest<IcmpSocket> request) { request.send(m_socket, request.getId().getAddress()); }
public JnaPingRequest(final JnaPingRequestId id, final long timeout, final int retries, final int packetsize, final PingResponseCallback cb) { m_id = id; m_retries = retries; m_packetsize = packetsize; m_timeout = timeout; m_callback = new LogPrefixPreservingPingResponseCallback(cb); }
@Override public double elapsedTime(TimeUnit timeUnit) { return m_packet.elapsedTime(timeUnit); }
@Override public long getSentTimeNanos() { return m_packet.getSentTimeNanos(); }
@Override public long getReceivedTimeNanos() { return m_packet.getReceivedTimeNanos(); }
@Override public void setTrafficClass(final int tc) throws Exception { if (m_pinger != null) { m_pinger.setTrafficClass(tc); } m_trafficClass = tc; }
@Override public int getIdentifier() { return m_packet.getIdentifier(); }
public Pinger getInstance() { return getInstance(0, true); }
@Override public void setAllowFragmentation(final boolean allow) throws Exception { if (m_pinger != null) { m_pinger.setAllowFragmentation(allow); } m_allowFragmentation = allow; }
/** * Returns true if the recovered packet is an echo reply. * * @return a boolean. */ @Override public boolean isEchoReply() { return m_packet.isEchoReply(); }
@Override public long getThreadId() { return m_packet.getThreadId(); }
/** {@inheritDoc} */ @Override public void handleError(InetAddress address, EchoPacket request, Throwable t) { try { if (request != null) { m_responseTimes[request.getSequenceNumber()] = null; } m_error = t; } finally { m_latch.countDown(); } }
@Override public void setTrafficClass(final int tc) throws Exception { if (m_pinger != null) { m_pinger.setTrafficClass(tc); } m_trafficClass = tc; }
@Override public void setAllowFragmentation(final boolean allow) throws Exception { if (m_pinger != null) { m_pinger.setAllowFragmentation(allow); } m_allowFragmentation = allow; }