Class FailoverTransport
java.lang.Object
org.apache.activemq.transport.failover.FailoverTransport
- All Implemented Interfaces:
Service,CompositeTransport,Transport
A Transport that is made reliable by being able to fail over to another
transport when a transport failure is detected.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidasyncRequest(Object command, ResponseCallback responseCallback) An asynchronous request response where the Receipt will be returned in the future.voidconnectionInterruptProcessingComplete(ConnectionId connectionId) final voiddisposeTransport(Transport transport) intintintlongintintlongintReturns a counter which gets incremented as data is read from the transport.longdoubleintlongReturns the current transport listenerintRetrieves the WireFormat instance associated with this Transport instance.final voidhandleConnectionControl(ConnectionControl control) final voidfinal voidhandleTransportFailure(Transport failed, IOException e) booleanisBackup()booleanbooleanbooleanbooleanIndicates if the transport can handle faultsprotected booleanisPriority(URI uri) booleanbooleanbooleanbooleanbooleanbooleanbooleanboolean<T> TvoidA one way asynchronous sendvoidreconnect(boolean rebalance) voidreconnect to another locationvoidA synchronous request responseA synchronous request responseprotected voidvoidsetBackup(boolean backup) voidsetBackupPoolSize(int backupPoolSize) voidsetInitialReconnectDelay(long initialReconnectDelay) voidsetMaxCacheSize(int maxCacheSize) voidsetMaxReconnectAttempts(int maxReconnectAttempts) voidsetMaxReconnectDelay(long maxReconnectDelay) voidsetNestedExtraQueryOptions(String nestedExtraQueryOptions) voidsetPeerCertificates(X509Certificate[] certificates) Sets the certificates provided by the connected peer.voidsetPriorityBackup(boolean priorityBackup) voidsetPriorityURIs(String priorityURIs) voidsetRandomize(boolean randomize) voidsetRebalanceUpdateURIs(boolean rebalanceUpdateURIs) voidsetReconnectDelay(long reconnectDelay) voidsetReconnectDelayExponent(double reconnectDelayExponent) voidsetReconnectSupported(boolean value) voidsetStartupMaxReconnectAttempts(int startupMaxReconnectAttempts) voidsetTimeout(long timeout) voidsetTrackMessages(boolean trackMessages) voidsetTrackTransactionProducers(boolean trackTransactionProducers) voidsetTransportListener(TransportListener commandListener) Registers an inbound command listenervoidsetUpdateURIsSupported(boolean value) voidsetUpdateURIsURL(String updateURIsURL) voidsetUseExponentialBackOff(boolean useExponentialBackOff) voidsetWarnAfterReconnectAttempts(int warnAfterReconnectAttempts) Sets the number of Connect / Reconnect attempts that must occur before a warn message is logged indicating that the transport is not connected.voidstart()voidstop()toString()voidupdateURIs(boolean rebalance, URI[] updatedURIs) Provide a list of available alternative locations
-
Constructor Details
-
FailoverTransport
public FailoverTransport()
-
-
Method Details
-
disposeTransport
-
handleTransportFailure
- Throws:
InterruptedException
-
handleTransportFailure
public final void handleTransportFailure(Transport failed, IOException e) throws InterruptedException - Throws:
InterruptedException
-
handleConnectionControl
-
start
-
stop
-
getInitialReconnectDelay
public long getInitialReconnectDelay() -
setInitialReconnectDelay
public void setInitialReconnectDelay(long initialReconnectDelay) -
getMaxReconnectDelay
public long getMaxReconnectDelay() -
setMaxReconnectDelay
public void setMaxReconnectDelay(long maxReconnectDelay) -
getReconnectDelay
public long getReconnectDelay() -
setReconnectDelay
public void setReconnectDelay(long reconnectDelay) -
getReconnectDelayExponent
public double getReconnectDelayExponent() -
setReconnectDelayExponent
public void setReconnectDelayExponent(double reconnectDelayExponent) -
getConnectedTransport
-
getConnectedTransportURI
-
getMaxReconnectAttempts
public int getMaxReconnectAttempts() -
setMaxReconnectAttempts
public void setMaxReconnectAttempts(int maxReconnectAttempts) -
getStartupMaxReconnectAttempts
public int getStartupMaxReconnectAttempts() -
setStartupMaxReconnectAttempts
public void setStartupMaxReconnectAttempts(int startupMaxReconnectAttempts) -
getTimeout
public long getTimeout() -
setTimeout
public void setTimeout(long timeout) -
isRandomize
public boolean isRandomize()- Returns:
- Returns the randomize.
-
setRandomize
public void setRandomize(boolean randomize) - Parameters:
randomize- The randomize to set.
-
isBackup
public boolean isBackup() -
setBackup
public void setBackup(boolean backup) -
getBackupPoolSize
public int getBackupPoolSize() -
setBackupPoolSize
public void setBackupPoolSize(int backupPoolSize) -
getCurrentBackups
public int getCurrentBackups() -
isTrackMessages
public boolean isTrackMessages() -
setTrackMessages
public void setTrackMessages(boolean trackMessages) -
isTrackTransactionProducers
public boolean isTrackTransactionProducers() -
setTrackTransactionProducers
public void setTrackTransactionProducers(boolean trackTransactionProducers) -
getMaxCacheSize
public int getMaxCacheSize() -
setMaxCacheSize
public void setMaxCacheSize(int maxCacheSize) -
isPriorityBackup
public boolean isPriorityBackup() -
setPriorityBackup
public void setPriorityBackup(boolean priorityBackup) -
setPriorityURIs
-
oneway
Description copied from interface:TransportA one way asynchronous send- Specified by:
onewayin interfaceTransport- Throws:
IOException
-
asyncRequest
public FutureResponse asyncRequest(Object command, ResponseCallback responseCallback) throws IOException Description copied from interface:TransportAn asynchronous request response where the Receipt will be returned in the future. If responseCallback is not null, then it will be called when the response has been completed.- Specified by:
asyncRequestin interfaceTransportresponseCallback- TODO- Returns:
- the FutureResponse
- Throws:
IOException
-
request
Description copied from interface:TransportA synchronous request response- Specified by:
requestin interfaceTransport- Returns:
- the response
- Throws:
IOException
-
request
Description copied from interface:TransportA synchronous request response- Specified by:
requestin interfaceTransport- Returns:
- the repsonse or null if timeout
- Throws:
IOException
-
add
- Specified by:
addin interfaceCompositeTransport
-
remove
- Specified by:
removein interfaceCompositeTransport
-
add
-
reconnect
public void reconnect(boolean rebalance) -
getTransportListener
Description copied from interface:TransportReturns the current transport listener- Specified by:
getTransportListenerin interfaceTransport- Returns:
-
setTransportListener
Description copied from interface:TransportRegisters an inbound command listener- Specified by:
setTransportListenerin interfaceTransport
-
narrow
-
restoreTransport
- Throws:
ExceptionIOException
-
isUseExponentialBackOff
public boolean isUseExponentialBackOff() -
setUseExponentialBackOff
public void setUseExponentialBackOff(boolean useExponentialBackOff) -
toString
-
getRemoteAddress
- Specified by:
getRemoteAddressin interfaceTransport- Returns:
- the remote address for this connection
-
isFaultTolerant
public boolean isFaultTolerant()Description copied from interface:TransportIndicates if the transport can handle faults- Specified by:
isFaultTolerantin interfaceTransport- Returns:
- true if fault tolerant
-
isPriority
-
isDisposed
public boolean isDisposed()- Specified by:
isDisposedin interfaceTransport- Returns:
- true if the transport is disposed
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceTransport- Returns:
- true if the transport is connected
-
reconnect
Description copied from interface:Transportreconnect to another location- Specified by:
reconnectin interfaceTransport- Throws:
IOException- on failure of if not supported
-
isReconnectSupported
public boolean isReconnectSupported()- Specified by:
isReconnectSupportedin interfaceTransport- Returns:
- true if reconnect is supported
-
setReconnectSupported
public void setReconnectSupported(boolean value) -
isUpdateURIsSupported
public boolean isUpdateURIsSupported()- Specified by:
isUpdateURIsSupportedin interfaceTransport- Returns:
- true if updating uris is supported
-
setUpdateURIsSupported
public void setUpdateURIsSupported(boolean value) -
updateURIs
Description copied from interface:TransportProvide a list of available alternative locations- Specified by:
updateURIsin interfaceTransport- Throws:
IOException
-
getUpdateURIsURL
- Returns:
- the updateURIsURL
-
setUpdateURIsURL
- Parameters:
updateURIsURL- the updateURIsURL to set
-
isRebalanceUpdateURIs
public boolean isRebalanceUpdateURIs()- Returns:
- the rebalanceUpdateURIs
-
setRebalanceUpdateURIs
public void setRebalanceUpdateURIs(boolean rebalanceUpdateURIs) - Parameters:
rebalanceUpdateURIs- the rebalanceUpdateURIs to set
-
getReceiveCounter
public int getReceiveCounter()Description copied from interface:TransportReturns a counter which gets incremented as data is read from the transport. It should only be used to determine if there is progress being made in reading the next command from the transport. The value may wrap into the negative numbers.- Specified by:
getReceiveCounterin interfaceTransport- Returns:
- a counter which gets incremented as data is read from the transport.
-
getConnectFailures
public int getConnectFailures() -
connectionInterruptProcessingComplete
-
getStateTracker
-
isConnectedToPriority
public boolean isConnectedToPriority() -
setNestedExtraQueryOptions
-
getWarnAfterReconnectAttempts
public int getWarnAfterReconnectAttempts() -
setWarnAfterReconnectAttempts
public void setWarnAfterReconnectAttempts(int warnAfterReconnectAttempts) Sets the number of Connect / Reconnect attempts that must occur before a warn message is logged indicating that the transport is not connected. This can be useful when the client is running inside some container or service as it give an indication of some problem with the client connection that might not otherwise be visible. To disable the log messages this value should be set to a value @{code attempts <= 0}- Parameters:
warnAfterReconnectAttempts- The number of failed connection attempts that must happen before a warning is logged.
-
getPeerCertificates
- Specified by:
getPeerCertificatesin interfaceTransport- Returns:
- the Certificates provided by the peer, or null if not a secure channel.
-
setPeerCertificates
Description copied from interface:TransportSets the certificates provided by the connected peer.- Specified by:
setPeerCertificatesin interfaceTransport- Parameters:
certificates- the Certificates provided by the peer.
-
getWireFormat
Description copied from interface:TransportRetrieves the WireFormat instance associated with this Transport instance.- Specified by:
getWireFormatin interfaceTransport- Returns:
- the WireFormat in use.
-