/** * Will close current SNMP mapping. */ @OnStopped public void close() { try { if (this.targetResource != null) { this.targetResource.close(); } } catch (Exception e) { this.getLogger().warn("Failure while closing target resource " + this.targetResource, e); } this.targetResource = null; try { if (this.transportMapping != null) { this.transportMapping.close(); } } catch (IOException e) { this.getLogger().warn("Failure while closing UDP transport mapping", e); } this.transportMapping = null; try { if (this.snmp != null) { this.snmp.close(); } } catch (IOException e) { this.getLogger().warn("Failure while closing UDP transport mapping", e); } this.snmp = null; }
/** * Closes a list of transport mappings. * * @param transportMappings * a list of {@link TransportMapping} instances. * * @throws IOException * if a transport cannot be closed. */ protected static void stopTransportMappings(Collection<? extends TransportMapping> transportMappings) throws IOException { ArrayList<TransportMapping> l = new ArrayList<TransportMapping>(transportMappings); for (TransportMapping tm : l) { tm.close(); } }
/** * Closes a list of transport mappings. * @param transportMappings * a list of {@link TransportMapping} instances. * @throws IOException * if a transport cannot be closed. */ protected static void stopTransportMappings(Collection transportMappings) throws IOException { ArrayList l = new ArrayList(transportMappings); for (Iterator it = l.iterator(); it.hasNext();) { TransportMapping tm = (TransportMapping) it.next(); if (tm.isListening()) { tm.close(); } } }
@Override protected void doStop() throws Exception { // stop listening to the transport if (this.transport != null && this.transport.isListening()) { LOG.info("Stopping OID poller on {}", targetAddress); this.transport.close(); LOG.info("Stopped OID poller on {}", targetAddress); } super.doStop(); }
public synchronized void closeAll() { notificationTransports.clear(); for (Iterator it = notificationListeners.values().iterator(); it.hasNext();) { TransportMapping tm = (TransportMapping) it.next(); try { tm.close(); } catch (IOException ex) { logger.error(ex); if (logger.isDebugEnabled()) { ex.printStackTrace(); } } } notificationListeners.clear(); }
protected void closeTransportMapping(TransportMapping tm) { try { tm.close(); } catch (IOException ex) { logger.error(ex); if (logger.isDebugEnabled()) { ex.printStackTrace(); } } }
protected void closeTransportMapping(TransportMapping<?> tm) { try { tm.close(); } catch (IOException ex) { logger.error(ex); if (logger.isDebugEnabled()) { ex.printStackTrace(); } } }
@Override public synchronized void stop() throws Exception { // stop listening to the transport if (this.transport.isListening()) { this.transport.close(); } super.stop(); }
@Override protected void doStop() throws Exception { // stop listening to the transport if (this.transport != null && this.transport.isListening()) { if (LOG.isDebugEnabled()) { LOG.debug("Stopping trap consumer on {}", this.endpoint.getAddress()); } this.transport.close(); LOG.info("Stopped trap consumer on {}", this.endpoint.getAddress()); } super.doStop(); }
public synchronized boolean removeNotificationListener(Address listenAddress) { TransportMapping tm = (TransportMapping)notificationListeners.remove(listenAddress); if (tm == null) { return false; } tm.removeTransportListener(messageDispatcher); notificationTransports.remove(tm); try { tm.close(); } catch (IOException ex) { logger.error(ex); if (logger.isDebugEnabled()) { ex.printStackTrace(); } } return true; }
@Override public synchronized void stop() throws Exception { // stop listening only if the endpoint was initialized if (isEnabled()) { // stop listening to the transport if (this.transport.isListening()) { this.transport.close(); } } super.stop(); }
TransportMapping tm = (TransportMapping) it.next(); if (tm.isListening()) { tm.close();
public void close() throws IOException { for (TransportMapping<?> tm : messageDispatcher.getTransportMappings()) { tm.close();
transport.close(); } catch (Exception e) { } try {
} finally { try { transport.close(); } catch (Exception e) { } try {
try { if (transportMapping != null) { transportMapping.close();
try { if (transportMapping != null) { transportMapping.close();
/** * Will close current SNMP mapping. */ @OnStopped public void close() { try { if (this.targetResource != null) { this.targetResource.close(); } } catch (Exception e) { this.getLogger().warn("Failure while closing target resource " + this.targetResource, e); } this.targetResource = null; try { if (this.transportMapping != null) { this.transportMapping.close(); } } catch (IOException e) { this.getLogger().warn("Failure while closing UDP transport mapping", e); } this.transportMapping = null; try { if (this.snmp != null) { this.snmp.close(); } } catch (IOException e) { this.getLogger().warn("Failure while closing UDP transport mapping", e); } this.snmp = null; }