public class AuthenticationConnectionFactory extends Object implements ProxiedConnectionFactory
AuthenticatingConnection
s.Constructor and Description |
---|
AuthenticationConnectionFactory(ProxiedConnectionFactory factory,
MongoClientConfiguration config)
Creates a new AuthenticationConnectionFactory.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
AuthenticatingConnection |
connect()
Creates a connection to the address provided.
|
AuthenticatingConnection |
connect(ServerState server,
MongoClientConfiguration config)
Creates a connection to the address provided.
|
ClusterType |
getClusterType()
Returns the type of cluster the connection factory connects to.
|
ReconnectStrategy |
getReconnectStrategy()
Returns the reconnection strategy for the type of connections.
|
public AuthenticationConnectionFactory(ProxiedConnectionFactory factory, MongoClientConfiguration config)
factory
- The factory to wrap connections wit
AuthenticatingConnection
.config
- The default config.public void close()
Overridden to close the proxied ConnectionFactory
.
close
in interface Closeable
close
in interface AutoCloseable
public AuthenticatingConnection connect() throws IOException
Overridden to return a connection then ensures the connection is properly authenticated before reconnecting.
connect
in interface ConnectionFactory
IOException
- On a failure connecting to the server.public AuthenticatingConnection connect(ServerState server, MongoClientConfiguration config) throws IOException
Overridden to wrap the returned connection with an
AuthenticatingConnection
.
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 ClusterType getClusterType()
Overridden to return the cluster type of the proxied
ConnectionFactory
.
getClusterType
in interface ConnectionFactory
public ReconnectStrategy getReconnectStrategy()
Overridden to return the delegates strategy but replace his connection factory with our own.
getReconnectStrategy
in interface ConnectionFactory
Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.