/** {@inheritDoc} */ @Override public synchronized void start() { LOG.debug("Calling start()"); super.start(); LOG.debug("Called start()"); }
/** * Initializes this singleton * @throws Exception */ private synchronized void initialize() throws Exception { if (m_pingTracker != null) return; try { m_messenger = new JnaIcmpMessenger(m_pingerId); m_pingTracker = Logging.withPrefix("icmp", new Callable<RequestTracker<JnaPingRequest,JnaPingReply>>() { @Override public RequestTracker<JnaPingRequest, JnaPingReply> call() throws Exception { return new RequestTracker<JnaPingRequest, JnaPingReply>("JNA-ICMP-"+m_pingerId, m_messenger, new IDBasedRequestLocator<JnaPingRequestId, JnaPingRequest, JnaPingReply>()); } }); m_pingTracker.start(); } catch (final IOException e) { final String errorMessage = e.getMessage().toLowerCase(); if (errorMessage.contains("permission denied") || errorMessage.contains("operation not permitted")) { LOG.error("Permission error received while attempting to open ICMP socket. See https://wiki.opennms.org/wiki/ICMP for information on configuring ICMP for non-root."); } throw e; } }
/** * Initializes this singleton * * @throws java.io.IOException if any. */ private synchronized void initialize() throws Exception { if (s_pingTracker != null) return; try { m_messenger = new JniIcmpMessenger(m_pingerId); s_pingTracker = Logging.withPrefix("icmp", new Callable<RequestTracker<JniPingRequest, JniPingResponse>>() { @Override public RequestTracker<JniPingRequest, JniPingResponse> call() throws Exception { return new RequestTracker<JniPingRequest, JniPingResponse>("JNI-ICMP-"+m_pingerId, m_messenger, new IDBasedRequestLocator<JniPingRequestId, JniPingRequest, JniPingResponse>()); } }); s_pingTracker.start(); } catch (final IOException ioe) { m_error = ioe; final String errorMessage = m_error.getMessage().toLowerCase(); if (errorMessage.contains("permission denied") || errorMessage.contains("operation not permitted")) { LOG.error("Permission error received while attempting to open ICMP socket. See https://wiki.opennms.org/wiki/ICMP for information on configuring ICMP for non-root."); } s_pingTracker = null; throw ioe; } catch (final RuntimeException rte) { m_error = rte; s_pingTracker = null; throw rte; } }
@Override public synchronized void initialize6() throws Exception { if (s_pingTracker != null) return; final String name = "JNI-ICMPv6-"+m_pingerId; final IDBasedRequestLocator<Jni6PingRequestId, Jni6PingRequest, Jni6PingResponse> requestLocator = new IDBasedRequestLocator<Jni6PingRequestId, Jni6PingRequest, Jni6PingResponse>(); try { m_jni6messenger = new Jni6IcmpMessenger(m_pingerId); s_pingTracker = Logging.withPrefix("icmp", new Callable<RequestTracker<Jni6PingRequest, Jni6PingResponse>>() { @Override public RequestTracker<Jni6PingRequest, Jni6PingResponse> call() throws Exception { return new RequestTracker<Jni6PingRequest, Jni6PingResponse>(name, m_jni6messenger, requestLocator); } }); s_pingTracker.start(); } catch (final IOException ioe) { m_v6Error = ioe; final String errorMessage = m_v6Error.getMessage().toLowerCase(); if (errorMessage.contains("permission denied") || errorMessage.contains("operation not permitted")) { LOG.error("Permission error received while attempting to open ICMP socket. See https://wiki.opennms.org/wiki/ICMP for information on configuring ICMP for non-root."); } throw ioe; } catch (final RuntimeException rte) { m_v6Error = rte; throw rte; } }
@Override public synchronized void initialize6() throws Exception { if (s_pingTracker != null) return; final String name = "JNI-ICMPv6-"+m_pingerId; final IDBasedRequestLocator<Jni6PingRequestId, Jni6PingRequest, Jni6PingResponse> requestLocator = new IDBasedRequestLocator<Jni6PingRequestId, Jni6PingRequest, Jni6PingResponse>(); try { m_jni6messenger = new Jni6IcmpMessenger(m_pingerId); s_pingTracker = Logging.withPrefix("icmp", new Callable<RequestTracker<Jni6PingRequest, Jni6PingResponse>>() { @Override public RequestTracker<Jni6PingRequest, Jni6PingResponse> call() throws Exception { return new RequestTracker<Jni6PingRequest, Jni6PingResponse>(name, m_jni6messenger, requestLocator); } }); s_pingTracker.start(); } catch (final IOException ioe) { m_v6Error = ioe; final String errorMessage = m_v6Error.getMessage().toLowerCase(); if (errorMessage.contains("permission denied") || errorMessage.contains("operation not permitted")) { LOG.error("Permission error received while attempting to open ICMP socket. See https://wiki.opennms.org/wiki/ICMP for information on configuring ICMP for non-root."); } throw ioe; } catch (final RuntimeException rte) { m_v6Error = rte; throw rte; } }
/** * Initializes this singleton * * @throws java.io.IOException if any. */ public synchronized void initialize() throws IOException { if (s_pingTracker != null) return; s_pingTracker = new RequestTracker<PingRequest<IcmpSocket>, PingReply>("ICMP", new IcmpMessenger(), new IDBasedRequestLocator<PingRequestId, PingRequest<IcmpSocket>, PingReply>()); s_pingTracker.start(); }