public class EndpointConnectionPool extends Object implements PeerStatusProvider
| Modifier and Type | Class and Description |
|---|---|
private class |
EndpointConnectionPool.IdEnrichedRemoteDestination |
| Modifier and Type | Field and Description |
|---|---|
private Set<EndpointConnection> |
activeConnections |
private int |
commsTimeout |
private ConcurrentMap<PeerDescription,BlockingQueue<EndpointConnection>> |
connectionQueueMap |
private EventReporter |
eventReporter |
private int |
idleExpirationMillis |
private InetAddress |
localAddress |
private static org.slf4j.Logger |
logger |
private PeerSelector |
peerSelector |
private RemoteDestination |
remoteDestination |
private boolean |
shutdown |
private SiteInfoProvider |
siteInfoProvider |
private SSLContext |
sslContext |
private ScheduledExecutorService |
taskExecutor |
| Constructor and Description |
|---|
EndpointConnectionPool(RemoteDestination remoteDestination,
int commsTimeoutMillis,
int idleExpirationMillis,
SSLContext sslContext,
EventReporter eventReporter,
PeerPersistence peerPersistence,
SiteInfoProvider siteInfoProvider,
InetAddress localAddress) |
private static final org.slf4j.Logger logger
private final ConcurrentMap<PeerDescription,BlockingQueue<EndpointConnection>> connectionQueueMap
private final Set<EndpointConnection> activeConnections
private final EventReporter eventReporter
private final SSLContext sslContext
private final ScheduledExecutorService taskExecutor
private final int idleExpirationMillis
private final RemoteDestination remoteDestination
private volatile int commsTimeout
private volatile boolean shutdown
private final SiteInfoProvider siteInfoProvider
private final PeerSelector peerSelector
private final InetAddress localAddress
public EndpointConnectionPool(RemoteDestination remoteDestination, int commsTimeoutMillis, int idleExpirationMillis, SSLContext sslContext, EventReporter eventReporter, PeerPersistence peerPersistence, SiteInfoProvider siteInfoProvider, InetAddress localAddress)
private String getPortIdentifier(TransferDirection transferDirection) throws IOException
IOExceptionpublic EndpointConnection getEndpointConnection(TransferDirection direction) throws IOException
IOExceptionpublic EndpointConnection getEndpointConnection(TransferDirection direction, SiteToSiteClientConfig config) throws IOException
IOExceptionpublic boolean offer(EndpointConnection endpointConnection)
private void cleanup(SocketClientProtocol protocol, Peer peer)
public PeerDescription getBootstrapPeerDescription() throws IOException
PeerStatusProviderReturns a PeerDescription instance, which represents a bootstrap remote NiFi node. The bootstrap node is always used to fetch remote peer statuses.
Once the PeerSelector successfully got remote peer statuses, it periodically fetches remote peer statuses,
so that it can detect remote NiFi cluster topology changes such as addition or removal of nodes.
To refresh remote peer statuses, PeerSelector calls PeerStatusProvider.fetchRemotePeerStatuses(org.apache.nifi.remote.PeerDescription) with one of query-able nodes
lastly fetched from the remote NiFi cluster, until it gets a successful result,
or throws IOException if none of them responds successfully.
This mechanism lets PeerSelector works even if the bootstrap remote NiFi node goes down.
getBootstrapPeerDescription in interface PeerStatusProviderIOException - thrown when it fails to retrieve the bootstrap remote node informationpublic Set<PeerStatus> fetchRemotePeerStatuses(PeerDescription peerDescription) throws IOException
PeerStatusProviderfetchRemotePeerStatuses in interface PeerStatusProviderpeerDescription - a bootstrap node or one of query-able nodes lastly fetched successfullyIOException - thrown when it fails to fetch peer statuses of the remote cluster from the specified peerpublic String getRemoteInstanceUris()
PeerStatusProvidergetRemoteInstanceUris in interface PeerStatusProviderprivate CommunicationsSession establishSiteToSiteConnection(PeerStatus peerStatus) throws IOException
IOExceptionprivate CommunicationsSession establishSiteToSiteConnection(String hostname, int port) throws IOException
IOExceptionprivate void cleanupExpiredSockets()
public void shutdown()
public void terminate(EndpointConnection connection)
public SiteToSiteTransportProtocol getTransportProtocol()
PeerStatusProvidergetTransportProtocol in interface PeerStatusProviderCopyright © 2023 Apache NiFi Project. All rights reserved.