public class SocketConnectionFactory extends Object implements ProxiedConnectionFactory
ConnectionFactory
to create direct socket connections to the servers.Modifier and Type | Class and Description |
---|---|
protected class |
SocketConnectionFactory.ConfigurationListener
ConfigurationListener provides a listener for changes in the client's
configuration.
|
Constructor and Description |
---|
SocketConnectionFactory(MongoClientConfiguration config)
Creates a new
SocketConnectionFactory . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
configurationChanged(PropertyChangeEvent evt)
Notification of a change to the configuration of the client.
|
Connection |
connect()
Creates a connection to the address provided.
|
Connection |
connect(Server server,
MongoClientConfiguration config)
Creates a connection to the address provided.
|
Cluster |
getCluster()
Returns the cluster state.
|
ClusterStats |
getClusterStats()
Returns the meta-data on the current cluster.
|
ClusterType |
getClusterType()
Returns the type of cluster the connection factory connects to.
|
ReconnectStrategy |
getReconnectStrategy()
Returns the reconnection strategy for the type of connections.
|
public SocketConnectionFactory(MongoClientConfiguration config)
SocketConnectionFactory
.config
- The MongoDB client configuration.public void close()
Overridden to do nothing.
close
in interface Closeable
close
in interface AutoCloseable
public Connection connect() throws IOException
Returns a new SocketConnection
.
connect
in interface ConnectionFactory
IOException
- On a failure connecting to the server.ConnectionFactory.connect()
public Connection connect(Server server, MongoClientConfiguration config) throws IOException
connect
in interface ProxiedConnectionFactory
server
- The MongoDB server to connect to.config
- The configuration for the Connection to the MongoDB server.IOException
- On a failure connecting to the server.public Cluster getCluster()
public ClusterStats getClusterStats()
Overridden to return the Cluster
.
getClusterStats
in interface ConnectionFactory
public ClusterType getClusterType()
Overridden to return ClusterType.STAND_ALONE
cluster type.
getClusterType
in interface ConnectionFactory
public ReconnectStrategy getReconnectStrategy()
Overridden to return a SimpleReconnectStrategy
.
getReconnectStrategy
in interface ConnectionFactory
protected void configurationChanged(PropertyChangeEvent evt)
evt
- The details of the configuration change.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.