public abstract class AbstractReconnectStrategy extends Object implements ReconnectStrategy
Modifier and Type | Field and Description |
---|---|
protected MongoClientConfiguration |
myConfig
The configuration for connections to the servers.
|
protected ProxiedConnectionFactory |
myConnectionFactory
The connection factory for new connections.
|
protected ServerSelector |
mySelector
The selector for which server to connect to.
|
protected ClusterState |
myState
The state of the cluster.
|
Constructor and Description |
---|
AbstractReconnectStrategy()
Creates a new AbstractReconnectStrategy.
|
Modifier and Type | Method and Description |
---|---|
protected void |
copyPending(Connection newConnection,
Connection oldConnection)
Copies the oldConnection pending messages to the
newConnection.
|
MongoClientConfiguration |
getConfig()
Returns the configuration for connections to the servers.
|
ProxiedConnectionFactory |
getConnectionFactory()
Returns the connection factory for new connections.
|
ServerSelector |
getSelector()
Returns the selector for which server to connect to.
|
ClusterState |
getState()
Returns the state of the cluster.
|
protected boolean |
isConnected(ServerState server,
Connection connection)
Pings the server to verify that the connection is active.
|
void |
setConfig(MongoClientConfiguration config)
Sets the configuration to be used by the reconnection strategy.
|
void |
setConnectionFactory(ProxiedConnectionFactory connectionFactory)
Sets the connection factory to use to establish connections to the
server.
|
void |
setSelector(ServerSelector selector)
Sets the selector to be used by the reconnection strategy.
|
void |
setState(ClusterState state)
Sets the state of the cluster to be used by the reconnection strategy.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
reconnect
protected MongoClientConfiguration myConfig
protected ProxiedConnectionFactory myConnectionFactory
protected ServerSelector mySelector
protected ClusterState myState
public AbstractReconnectStrategy()
public MongoClientConfiguration getConfig()
public ProxiedConnectionFactory getConnectionFactory()
public ServerSelector getSelector()
public ClusterState getState()
public void setConfig(MongoClientConfiguration config)
setConfig
in interface ReconnectStrategy
config
- The configuration for the connections.public void setConnectionFactory(ProxiedConnectionFactory connectionFactory)
setConnectionFactory
in interface ReconnectStrategy
connectionFactory
- The connection factory to use to establish connections to the
server.public void setSelector(ServerSelector selector)
setSelector
in interface ReconnectStrategy
selector
- The selector for connections.public void setState(ClusterState state)
setState
in interface ReconnectStrategy
state
- The state of the cluster.protected void copyPending(Connection newConnection, Connection oldConnection)
newConnection
- The connection to copy the messages to.oldConnection
- The connection to copy the messages from.protected boolean isConnected(ServerState server, Connection connection)
server
- The server being connected to.connection
- The connection to verify.Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.