private static Cluster createCluster(final ClusterSettings clusterSettings, final List<MongoCredential> credentialsList, final MongoClientOptions options, @Nullable final MongoDriverInformation mongoDriverInformation) { MongoDriverInformation.Builder builder = mongoDriverInformation == null ? MongoDriverInformation.builder() : MongoDriverInformation.builder(mongoDriverInformation); return new DefaultClusterFactory().createCluster(clusterSettings, options.getServerSettings(), options.getConnectionPoolSettings(), new SocketStreamFactory(options.getSocketSettings(), options.getSslSettings(), options.getSocketFactory()), new SocketStreamFactory(options.getHeartbeatSocketSettings(), options.getSslSettings(), options.getSocketFactory()), credentialsList, getCommandListener(options.getCommandListeners()), options.getApplicationName(), builder.driverName("legacy").build(), options.getCompressorList()); }
/** * Creates a new {@code MongoOptions} with the given options. This class is deprecated, use {@link com.mongodb.MongoClientOptions}. * * @param options the MongoClientOptions to copy values from into the new MongoOptions. * @deprecated use {@link com.mongodb.MongoClientOptions} */ @SuppressWarnings("deprecation") @Deprecated public MongoOptions(final MongoClientOptions options) { connectionsPerHost = options.getConnectionsPerHost(); threadsAllowedToBlockForConnectionMultiplier = options.getThreadsAllowedToBlockForConnectionMultiplier(); maxWaitTime = options.getMaxWaitTime(); connectTimeout = options.getConnectTimeout(); socketFactory = options.getSocketFactory(); socketTimeout = options.getSocketTimeout(); socketKeepAlive = options.isSocketKeepAlive(); readPreference = options.getReadPreference(); dbDecoderFactory = options.getDbDecoderFactory(); dbEncoderFactory = options.getDbEncoderFactory(); description = options.getDescription(); writeConcern = options.getWriteConcern(); alwaysUseMBeans = options.isAlwaysUseMBeans(); requiredReplicaSetName = options.getRequiredReplicaSetName(); }
Assert.assertEquals(INSECURE_SSL_SOCKET_FACTORY, options.getSocketFactory()); Assert.assertEquals(SSLSocketFactory.getDefault().getClass(), options.getSocketFactory().getClass());
Assert.assertEquals(INSECURE_SSL_SOCKET_FACTORY, options.getSocketFactory()); Assert.assertEquals(SSLSocketFactory.getDefault().getClass(), options.getSocketFactory().getClass());
private void testAddress(HostAndPort address, MongoClientOptions options) throws UnreachableMongoServerException { SocketAddress sa = new InetSocketAddress(address.getHostText(), address.getPort()); try (Socket s = options.getSocketFactory().createSocket()) { s.connect(sa, 3000); } catch (IOException ex) { throw new UnreachableMongoServerException(address, ex); } }
private void testAddress(HostAndPort address, MongoClientOptions options) throws UnreachableMongoServerException { SocketAddress sa = new InetSocketAddress(address.getHostText(), address.getPort()); try (Socket s = options.getSocketFactory().createSocket()) { s.connect(sa, 3000); } catch (IOException ex) { throw new UnreachableMongoServerException(address, ex); } }
private static Cluster createCluster(final ClusterSettings clusterSettings, final List<MongoCredential> credentialsList, final MongoClientOptions options, @Nullable final MongoDriverInformation mongoDriverInformation) { MongoDriverInformation.Builder builder = mongoDriverInformation == null ? MongoDriverInformation.builder() : MongoDriverInformation.builder(mongoDriverInformation); return new DefaultClusterFactory().createCluster(clusterSettings, options.getServerSettings(), options.getConnectionPoolSettings(), new SocketStreamFactory(options.getSocketSettings(), options.getSslSettings(), options.getSocketFactory()), new SocketStreamFactory(options.getHeartbeatSocketSettings(), options.getSslSettings(), options.getSocketFactory()), credentialsList, getCommandListener(options.getCommandListeners()), options.getApplicationName(), builder.driverName("legacy").build(), options.getCompressorList()); }
/** * Creates a new {@code MongoOptions} with the given options. This class is deprecated, use {@link com.mongodb.MongoClientOptions}. * * @param options the MongoClientOptions to copy values from into the new MongoOptions. * @deprecated use {@link com.mongodb.MongoClientOptions} */ @SuppressWarnings("deprecation") @Deprecated public MongoOptions(final MongoClientOptions options) { connectionsPerHost = options.getConnectionsPerHost(); threadsAllowedToBlockForConnectionMultiplier = options.getThreadsAllowedToBlockForConnectionMultiplier(); maxWaitTime = options.getMaxWaitTime(); connectTimeout = options.getConnectTimeout(); socketFactory = options.getSocketFactory(); socketTimeout = options.getSocketTimeout(); socketKeepAlive = options.isSocketKeepAlive(); readPreference = options.getReadPreference(); dbDecoderFactory = options.getDbDecoderFactory(); dbEncoderFactory = options.getDbEncoderFactory(); description = options.getDescription(); writeConcern = options.getWriteConcern(); alwaysUseMBeans = options.isAlwaysUseMBeans(); requiredReplicaSetName = options.getRequiredReplicaSetName(); }