public class ReplicaSetConnectionFactory extends Object implements ConnectionFactory
| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
LOG
The logger for the
ReplicaSetConnectionFactory. |
protected ProxiedConnectionFactory |
myConnectionFactory
The factory to create proxied connections.
|
| Constructor and Description |
|---|
ReplicaSetConnectionFactory(ProxiedConnectionFactory factory,
MongoClientConfiguration config)
Creates a new
ReplicaSetConnectionFactory. |
| Modifier and Type | Method and Description |
|---|---|
void |
bootstrap()
Finds the primary member of the replica set.
|
void |
close() |
Connection |
connect()
Creates a new connection to the replica set.
|
protected ClusterState |
getClusterState()
Returns the clusterState value.
|
ClusterType |
getClusterType()
Returns the type of cluster the connection factory connects to.
|
ReconnectStrategy |
getReconnectStrategy()
Returns the reconnection strategy for the type of connections.
|
protected static final Logger LOG
ReplicaSetConnectionFactory.protected final ProxiedConnectionFactory myConnectionFactory
public ReplicaSetConnectionFactory(ProxiedConnectionFactory factory, MongoClientConfiguration config)
ReplicaSetConnectionFactory.factory - The factory to create proxied connections.config - The MongoDB client configuration.public void bootstrap()
public void close()
Overridden to close the cluster state and the
ProxiedConnectionFactory.
close in interface Closeableclose in interface AutoCloseablepublic Connection connect() throws IOException
connect in interface ConnectionFactoryIOException - On a failure connecting to the server.ConnectionFactory.connect()public ClusterType getClusterType()
Overridden to return ClusterType.REPLICA_SET cluster type.
getClusterType in interface ConnectionFactorypublic ReconnectStrategy getReconnectStrategy()
Overridden to return a replica set ReconnectStrategy.
getReconnectStrategy in interface ConnectionFactoryprotected ClusterState getClusterState()
Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.