/** * Construct an instance. * * @param connectionId the connection id * @param maxWireVersion the max wire version * @param serverType the server type * @param maxBatchCount the max batch count * @param maxDocumentSize the max document size in bytes * @param maxMessageSize the max message size in bytes * @param compressors the available compressors on the connection * @since 3.10 */ public ConnectionDescription(final ConnectionId connectionId, final int maxWireVersion, final ServerType serverType, final int maxBatchCount, final int maxDocumentSize, final int maxMessageSize, final List<String> compressors) { this(connectionId, new ServerVersion(), maxWireVersion, serverType, maxBatchCount, maxDocumentSize, maxMessageSize, compressors); }
/** * 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()); }
static ServerVersion getVersion(final BsonDocument buildInfoResult) { List<BsonValue> versionArray = buildInfoResult.getArray("versionArray").subList(0, 3); return new ServerVersion(asList(versionArray.get(0).asInt32().getValue(), versionArray.get(1).asInt32().getValue(), versionArray.get(2).asInt32().getValue())); }
/** * Construct an instance. * * @param connectionId the connection id * @param maxWireVersion the max wire version * @param serverType the server type * @param maxBatchCount the max batch count * @param maxDocumentSize the max document size in bytes * @param maxMessageSize the max message size in bytes * @param compressors the available compressors on the connection * @since 3.10 */ public ConnectionDescription(final ConnectionId connectionId, final int maxWireVersion, final ServerType serverType, final int maxBatchCount, final int maxDocumentSize, final int maxMessageSize, final List<String> compressors) { this(connectionId, new ServerVersion(), maxWireVersion, serverType, maxBatchCount, maxDocumentSize, maxMessageSize, compressors); }
/** * 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()); }
static ServerVersion getVersion(final BsonDocument buildInfoResult) { List<BsonValue> versionArray = buildInfoResult.getArray("versionArray").subList(0, 3); return new ServerVersion(asList(versionArray.get(0).asInt32().getValue(), versionArray.get(1).asInt32().getValue(), versionArray.get(2).asInt32().getValue())); }