public Cluster createCluster(final ClusterSettings clusterSettings, final ServerSettings serverSettings,
                                 final ConnectionPoolSettings connectionPoolSettings, final StreamFactory streamFactory,
                                 final StreamFactory heartbeatStreamFactory, final List<MongoCredential> credentialList,
                                 final CommandListener commandListener, final String applicationName,
                                 final MongoDriverInformation mongoDriverInformation,
                                 final List<MongoCompressor> compressorList) {
    """
	Creates a cluster with the given settings.  The cluster mode will be based on the mode from the settings.
	
	@param clusterSettings        the cluster settings
	@param serverSettings         the server settings
	@param connectionPoolSettings the connection pool settings
	@param streamFactory          the stream factory
	@param heartbeatStreamFactory the heartbeat stream factory
	@param credentialList         the credential list
	@param commandListener        an optional listener for command-related events
	@param applicationName        an optional application name to associate with connections to the servers in this cluster
	@param mongoDriverInformation the optional driver information associate with connections to the servers in this cluster
	@param compressorList         the list of compressors to request, in priority order
	@return the cluster
	
	@since 3.6
    """

        ClusterId clusterId = new ClusterId(clusterSettings.getDescription());


        ClusterableServerFactory serverFactory = new DefaultClusterableServerFactory(clusterId, clusterSettings, serverSettings,
                connectionPoolSettings, streamFactory, heartbeatStreamFactory, credentialList, commandListener, applicationName,
                mongoDriverInformation != null ? mongoDriverInformation : MongoDriverInformation.builder().build(), compressorList);

        DnsSrvRecordMonitorFactory dnsSrvRecordMonitorFactory = new DefaultDnsSrvRecordMonitorFactory(clusterId, serverSettings);

        if (clusterSettings.getMode() == ClusterConnectionMode.SINGLE) {
            return new SingleServerCluster(clusterId, clusterSettings, serverFactory);
        } else if (clusterSettings.getMode() == ClusterConnectionMode.MULTIPLE) {
            if (clusterSettings.getSrvHost() == null) {
                return new MultiServerCluster(clusterId, clusterSettings, serverFactory);
            } else {
                return new DnsMultiServerCluster(clusterId, clusterSettings, serverFactory, dnsSrvRecordMonitorFactory);
            }
        } else {
            throw new UnsupportedOperationException("Unsupported cluster mode: " + clusterSettings.getMode());
        }
    }
public Cluster createCluster(final ClusterSettings clusterSettings, final ServerSettings serverSettings,
                                 final ConnectionPoolSettings connectionPoolSettings, final StreamFactory streamFactory,
                                 final StreamFactory heartbeatStreamFactory, final List<MongoCredential> credentialList,
                                 final CommandListener commandListener, final String applicationName,
                                 final MongoDriverInformation mongoDriverInformation,
                                 final List<MongoCompressor> compressorList) {

        ClusterId clusterId = new ClusterId(clusterSettings.getDescription());


        ClusterableServerFactory serverFactory = new DefaultClusterableServerFactory(clusterId, clusterSettings, serverSettings,
                connectionPoolSettings, streamFactory, heartbeatStreamFactory, credentialList, commandListener, applicationName,
                mongoDriverInformation != null ? mongoDriverInformation : MongoDriverInformation.builder().build(), compressorList);

        DnsSrvRecordMonitorFactory dnsSrvRecordMonitorFactory = new DefaultDnsSrvRecordMonitorFactory(clusterId, serverSettings);

        if (clusterSettings.getMode() == ClusterConnectionMode.SINGLE) {
            return new SingleServerCluster(clusterId, clusterSettings, serverFactory);
        } else if (clusterSettings.getMode() == ClusterConnectionMode.MULTIPLE) {
            if (clusterSettings.getSrvHost() == null) {
                return new MultiServerCluster(clusterId, clusterSettings, serverFactory);
            } else {
                return new DnsMultiServerCluster(clusterId, clusterSettings, serverFactory, dnsSrvRecordMonitorFactory);
            }
        } else {
            throw new UnsupportedOperationException("Unsupported cluster mode: " + clusterSettings.getMode());
        }
    }
public Cluster createCluster ( final ClusterSettings clusterSettings , final ServerSettings serverSettings , final ConnectionPoolSettings connectionPoolSettings , final StreamFactory streamFactory , final StreamFactory heartbeatStreamFactory , final List < MongoCredential > credentialList , final CommandListener commandListener , final String applicationName , final MongoDriverInformation mongoDriverInformation , final List < MongoCompressor > compressorList ) { ClusterId clusterId = new ClusterId ( clusterSettings . getDescription ( ) ) ; ClusterableServerFactory serverFactory = new DefaultClusterableServerFactory ( clusterId , clusterSettings , serverSettings , connectionPoolSettings , streamFactory , heartbeatStreamFactory , credentialList , commandListener , applicationName , mongoDriverInformation != null ? mongoDriverInformation : MongoDriverInformation . builder ( ) . build ( ) , compressorList ) ; DnsSrvRecordMonitorFactory dnsSrvRecordMonitorFactory = new DefaultDnsSrvRecordMonitorFactory ( clusterId , serverSettings ) ; if ( clusterSettings . getMode ( ) == ClusterConnectionMode . SINGLE ) { return new SingleServerCluster ( clusterId , clusterSettings , serverFactory ) ; } else if ( clusterSettings . getMode ( ) == ClusterConnectionMode . MULTIPLE ) { if ( clusterSettings . getSrvHost ( ) == null ) { return new MultiServerCluster ( clusterId , clusterSettings , serverFactory ) ; } else { return new DnsMultiServerCluster ( clusterId , clusterSettings , serverFactory , dnsSrvRecordMonitorFactory ) ; } } else { throw new UnsupportedOperationException ( "Unsupported cluster mode: " + clusterSettings . getMode ( ) ) ; } }
Creates a cluster with the given settings.  The cluster mode will be based on the mode from the settings.

@param clusterSettings        the cluster settings
@param serverSettings         the server settings
@param connectionPoolSettings the connection pool settings
@param streamFactory          the stream factory
@param heartbeatStreamFactory the heartbeat stream factory
@param credentialList         the credential list
@param commandListener        an optional listener for command-related events
@param applicationName        an optional application name to associate with connections to the servers in this cluster
@param mongoDriverInformation the optional driver information associate with connections to the servers in this cluster
@param compressorList         the list of compressors to request, in priority order
@return the cluster

@since 3.6
Creates a cluster with the given settings . The cluster mode will be based on the mode from the settings .