Module logstash.logback.encoder
Class DestinationConnectionStrategyWithTtl
java.lang.Object
net.logstash.logback.appender.destination.DestinationConnectionStrategyWithTtl
- All Implemented Interfaces:
DestinationConnectionStrategy
- Direct Known Subclasses:
RandomDestinationConnectionStrategy,RoundRobinDestinationConnectionStrategy
public abstract class DestinationConnectionStrategyWithTtl
extends Object
implements DestinationConnectionStrategy
A
DestinationConnectionStrategy that will force a connection to be reestablished after a length of time has elapsed.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconnectFailed(long connectionStartTimeInMillis, int failedDestinationIndex, int numDestinations) Called when a connection fails to the given failedDestinationIndex.voidconnectSuccess(long connectionStartTimeInMillis, int connectedDestinationIndex, int numDestinations) Called when a connection was successful to the given connectedDestinationIndex.voidsetConnectionTTL(Duration connectionTTL) booleanshouldReconnect(long currentTimeInMillis, int currentDestinationIndex, int numDestinations) Returns whether the connection should be reestablished.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.logstash.logback.appender.destination.DestinationConnectionStrategy
selectNextDestinationIndex
-
Constructor Details
-
DestinationConnectionStrategyWithTtl
public DestinationConnectionStrategyWithTtl()
-
-
Method Details
-
connectSuccess
public void connectSuccess(long connectionStartTimeInMillis, int connectedDestinationIndex, int numDestinations) Description copied from interface:DestinationConnectionStrategyCalled when a connection was successful to the given connectedDestinationIndex.- Specified by:
connectSuccessin interfaceDestinationConnectionStrategy- Parameters:
connectionStartTimeInMillis- The time in millis at which the connection was initiated (not completed).connectedDestinationIndex- The index of the destination which was successfully connected.numDestinations- The total number of destinations available.
-
connectFailed
public void connectFailed(long connectionStartTimeInMillis, int failedDestinationIndex, int numDestinations) Description copied from interface:DestinationConnectionStrategyCalled when a connection fails to the given failedDestinationIndex.- Specified by:
connectFailedin interfaceDestinationConnectionStrategy- Parameters:
connectionStartTimeInMillis- The time in millis at which the connection was initiated (not completed).failedDestinationIndex- The index of the destination which failed to connect.numDestinations- The total number of destinations available.
-
shouldReconnect
public boolean shouldReconnect(long currentTimeInMillis, int currentDestinationIndex, int numDestinations) Description copied from interface:DestinationConnectionStrategyReturns whether the connection should be reestablished.- Specified by:
shouldReconnectin interfaceDestinationConnectionStrategy- Parameters:
currentTimeInMillis- The time in millis for which to reevaluate whether the connection should be reestablished.currentDestinationIndex- The index of the destination which is currently connectednumDestinations- The total number of destinations available.- Returns:
- true if the connection should be reestablished (to the destination returned by the next call to
DestinationConnectionStrategy.selectNextDestinationIndex(int, int), false otherwise.
-
getConnectionTTL
-
setConnectionTTL
-