Class DynamicTCPRemoteCommitProvider
java.lang.Object
org.apache.openjpa.event.AbstractRemoteCommitProvider
org.apache.openjpa.event.TCPRemoteCommitProvider
org.apache.openjpa.event.DynamicTCPRemoteCommitProvider
- All Implemented Interfaces:
RemoteCommitProvider, Configurable, Closeable
- Direct Known Subclasses:
KubernetesTCPRemoteCommitProvider
-
Nested Class Summary
Nested classes/interfaces inherited from class TCPRemoteCommitProvider
TCPRemoteCommitProvider.HostAddress -
Field Summary
Fields inherited from class TCPRemoteCommitProvider
_addresses, _addressesLock, _port, s_locFields inherited from class AbstractRemoteCommitProvider
eventManager, log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSubclasses that need to perform actions inConfigurable.endConfiguration()must invoke this method.intprotected voidrefreshAddresses(long acceptedNanos) Refreshes the addresses, unless a refresh started after the connection was accepted.protected booleanA peer that just came up may connect before the periodic refresh has discovered it, so the addresses are refreshed before a connection from an unknown host is rejected.final voidsetAddresses(String names) Sets the list of addresses of peers to which this provider will send events to.voidsetCacheDurationMillis(int _cacheDurationMillis) Methods inherited from class TCPRemoteCommitProvider
acceptsConnectionFrom, addressesChanged, broadcast, close, getMaxIdle, getMaxReceiveConnections, getMaxTotal, getNumBroadcastThreads, getPort, getRecoveryTimeMillis, isRestrictToPeers, setBindAddress, setMaxActive, setMaxIdle, setMaxReceiveConnections, setMaxTotal, setNumBroadcastThreads, setPort, setRecoveryTimeMillis, setRestrictToPeersMethods inherited from class AbstractRemoteCommitProvider
fireEvent, setConfiguration, setRemoteCommitEventManager, startConfiguration
-
Constructor Details
-
DynamicTCPRemoteCommitProvider
- Throws:
UnknownHostException
-
-
Method Details
-
getCacheDurationMillis
public int getCacheDurationMillis() -
setCacheDurationMillis
public void setCacheDurationMillis(int _cacheDurationMillis) -
setAddresses
Description copied from class:TCPRemoteCommitProviderSets the list of addresses of peers to which this provider will send events to. The peers are semicolon-separatednameslist in the form of "myhost1:portA;myhost2:portB".- Overrides:
setAddressesin classTCPRemoteCommitProvider- Parameters:
names- the list of addresses of peers to which this provider will send events to- Throws:
UnknownHostException- in case peer name cannot be resolved
-
endConfiguration
public void endConfiguration()Description copied from class:TCPRemoteCommitProviderSubclasses that need to perform actions inConfigurable.endConfiguration()must invoke this method.- Specified by:
endConfigurationin interfaceConfigurable- Overrides:
endConfigurationin classTCPRemoteCommitProvider
-
refreshesAddressesOnDemand
protected boolean refreshesAddressesOnDemand()A peer that just came up may connect before the periodic refresh has discovered it, so the addresses are refreshed before a connection from an unknown host is rejected.- Overrides:
refreshesAddressesOnDemandin classTCPRemoteCommitProvider- Returns:
trueifTCPRemoteCommitProvider.refreshAddresses(long)may find further peers
-
refreshAddresses
protected void refreshAddresses(long acceptedNanos) Refreshes the addresses, unless a refresh started after the connection was accepted. Refreshes run one at a time and at most once per second, so that connections from unknown hosts cannot flood the source of the addresses.- Overrides:
refreshAddressesin classTCPRemoteCommitProvider- Parameters:
acceptedNanos- theSystem.nanoTime()at which the connection was accepted; a refresh started later already covers this connection
-
fetchDynamicAddresses
-