/** * Gets a Builder for creating a new ConnectionPoolSettings instance. * * @param connectionPoolSettings the existing connection pool settings to configure the builder with * @return a new Builder for ConnectionPoolSettings * @since 3.5 */ public static Builder builder(final ConnectionPoolSettings connectionPoolSettings) { return builder().applySettings(connectionPoolSettings); }
/** * Creates a builder instance. * * @param socketSettings existing SocketSettings to default the builder settings on. * @return a builder * @since 3.7 */ public static Builder builder(final SocketSettings socketSettings) { return builder().applySettings(socketSettings); }
/** * Gets the server address. * * @return the server address */ public ServerAddress getServerAddress() { return connectionId.getServerId().getAddress(); }
private ConnectionPoolSettings getConnectionPoolSettings(final ConnectionPoolSettings connPoolSettings, final ConnectionPoolListener connPoolListener) { return ConnectionPoolSettings.builder(connPoolSettings).addConnectionPoolListener(connPoolListener).build(); } }
protected static ClusterDescription copyClusterDescription(final ClusterDescription clusterDescription, final List<ServerDescription> selectedServers) { return new ClusterDescription(clusterDescription.getConnectionMode(), clusterDescription.getType(), selectedServers, clusterDescription.getClusterSettings(), clusterDescription.getServerSettings()); }
/** * Creates a builder instance. * * @param clusterSettings existing ClusterSettings to default the builder settings on. * @return a builder * @since 3.5 */ public static Builder builder(final ClusterSettings clusterSettings) { return builder().applySettings(clusterSettings); }
@SuppressWarnings("deprecation") private List<ServerDescription> getServerDescriptionListToConsiderForSessionSupport(final ClusterDescription clusterDescription) { if (clusterDescription.getConnectionMode() == ClusterConnectionMode.SINGLE) { return clusterDescription.getAny(); } else { return clusterDescription.getAnyPrimaryOrSecondary(); } }
/** * Creates a builder instance. * * @param sslSettings existing SslSettings to default the builder settings on. * @return a builder * @since 3.7 */ public static Builder builder(final SslSettings sslSettings) { return builder().applySettings(sslSettings); }
/** * Creates a builder instance. * * @param serverSettings existing ServerSettings to default the builder settings on. * @return a builder * @since 3.5 */ public static Builder builder(final ServerSettings serverSettings) { return builder().applySettings(serverSettings); }
private boolean serversAreAllThreeDotFour(final ClusterDescription clusterDescription) { for (ServerDescription cur : clusterDescription.getServerDescriptions()) { if (cur.isOk() && cur.getMaxWireVersion() < 5) { return false; } } return true; }
/** * Construct a defaulted connection description instance. * * @param serverId the server address */ public ConnectionDescription(final ServerId serverId) { this(new ConnectionId(serverId), new ServerVersion(), 0, ServerType.UNKNOWN, DEFAULT_MAX_WRITE_BATCH_SIZE, getDefaultMaxDocumentSize(), DEFAULT_MAX_MESSAGE_SIZE, Collections.<String>emptyList()); }
@Override public int hashCode() { int result = connectionId.hashCode(); result = 31 * result + serverVersion.hashCode(); result = 31 * result + maxBatchCount; result = 31 * result + serverType.hashCode(); result = 31 * result + maxBatchCount; result = 31 * result + maxDocumentSize; result = 31 * result + maxMessageSize; result = 31 * result + compressors.hashCode(); return result; }
@Override public ByteBuf allocate(final int size) { return getBufferProvider().getBuffer(size); }
public boolean shouldProcessBatch() { return !bulkWriteBatchCombiner.shouldStopSendingMoreBatches() && !payload.isEmpty(); }
/** * Gets the list of added {@code ServerListener}. The default is an empty list. * * @return the unmodifiable list of server listeners * @since 3.3 */ public List<ServerListener> getServerListeners() { return serverSettings.getServerListeners(); }
/** * Gets a Builder for creating a new ServerDescription instance. * * @return a new Builder for ServerDescription. */ public static Builder builder() { return new Builder(); }
/** * Build the settings from the builder. * * @return the cluster settings */ public ClusterSettings build() { return new ClusterSettings(this); } }
/** * Creates a builder for ServerSettings. * * @return a new Builder for creating ServerSettings. */ public static Builder builder() { return new Builder(); }
/** * Build an instance of {@code AsynchronousSocketChannelStreamFactoryFactory}. * @return the AsynchronousSocketChannelStreamFactoryFactory */ public AsynchronousSocketChannelStreamFactoryFactory build() { return new AsynchronousSocketChannelStreamFactoryFactory(this); } }