List of usage examples for org.apache.http.nio.reactor ListeningIOReactor getEndpoints
Set<ListenerEndpoint> getEndpoints();
From source file:org.apache.synapse.transport.passthru.core.PassThroughListeningIOReactorManager.java
/** * Close all endpoints started by PTT Listeners. * * @param port Port of the Endpoint for PTT axis2 Listener * @return is all Endpoints closed/*from w w w. j av a2 s . c om*/ */ public boolean closeAllPTTListenerEndpoints(int port) { try { ListeningIOReactor listeningIOReactor = passThroughListenerIOReactorMapper.get(port); if (listeningIOReactor != null) { Set<ListenerEndpoint> endpoints = listeningIOReactor.getEndpoints(); // If it is shared IO Reactor then only close endpoints related to PTT Listener if (passThroughListenerServerIODispatchMapper.get(port) instanceof MultiListenerServerIODispatch) { for (ListenerEndpoint listenerEndpoint : endpoints) { if (listenerEndpoint.getAddress() instanceof InetSocketAddress) { int endPointPort = ((InetSocketAddress) listenerEndpoint.getAddress()).getPort(); if (dynamicPTTListeningEndpointMapper.containsKey(endPointPort)) { continue; } log.info("Closing Endpoint Listener for port " + port); listenerEndpoint.close(); log.info("Successfully closed Endpoint Listener for port " + port); } } } else { for (ListenerEndpoint listenerEndpoint : endpoints) { log.info("Closing Endpoint Listener for port " + port); listenerEndpoint.close(); log.info("Successfully closed Endpoint Listener for port " + port); } } } return true; } catch (Exception e) { log.error("Error occurred when closing Endpoint in PassThrough Transport Related to port " + port, e); return false; } }
From source file:org.apache.synapse.transport.passthru.core.PassThroughListeningIOReactorManager.java
/** * Close specific endpoints started by PTT Listeners using give set of bind addresses. * * @param port Port of the listener * @param bindAddresses bind address list of endpoints to be closed * @return true if successfully closed, false if any error *///from w w w . j a v a 2 s . co m public boolean closeSpecificPTTListenerEndpoints(int port, Set<InetSocketAddress> bindAddresses) { try { ListeningIOReactor listeningIOReactor = passThroughListenerIOReactorMapper.get(port); if (listeningIOReactor != null) { Set<ListenerEndpoint> endpoints = listeningIOReactor.getEndpoints(); // If it is shared IO Reactor then only close endpoints related to PTT Listener if (passThroughListenerServerIODispatchMapper.get(port) instanceof MultiListenerServerIODispatch) { for (ListenerEndpoint listenerEndpoint : endpoints) { if (listenerEndpoint.getAddress() instanceof InetSocketAddress) { int endPointPort = ((InetSocketAddress) listenerEndpoint.getAddress()).getPort(); if (dynamicPTTListeningEndpointMapper.containsKey(endPointPort)) { continue; } for (InetSocketAddress inetSocketAddress : bindAddresses) { if (inetSocketAddress.getHostName().equalsIgnoreCase( ((InetSocketAddress) listenerEndpoint.getAddress()).getHostName())) { listenerEndpoint.close(); } } } } } else { for (ListenerEndpoint listenerEndpoint : endpoints) { for (InetSocketAddress inetSocketAddress : bindAddresses) { if (inetSocketAddress.getHostName().equalsIgnoreCase( ((InetSocketAddress) listenerEndpoint.getAddress()).getHostName())) { listenerEndpoint.close(); } } } } } return true; } catch (Exception e) { log.error("Error occurred when closing Endpoint in PassThrough Transport Related to port " + port, e); return false; } }