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 Cluster |
myState
The state of the cluster.
|
Constructor and Description |
---|
AbstractReconnectStrategy()
Creates a new AbstractReconnectStrategy.
|
Modifier and Type | Method and Description |
---|---|
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.
|
Cluster |
getState()
Returns the state of the cluster.
|
protected boolean |
isConnected(Server 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(Cluster 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 Cluster myState
public AbstractReconnectStrategy()
public MongoClientConfiguration getConfig()
public ProxiedConnectionFactory getConnectionFactory()
public ServerSelector getSelector()
public Cluster 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(Cluster state)
setState
in interface ReconnectStrategy
state
- The state of the cluster.protected boolean isConnected(Server server, Connection connection)
server
- The server being connected to.connection
- The connection to verify.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.