Skip to content

Commit 3e77705

Browse files
committed
Moved driver-core connection implementation into internal
1 parent 592f359 commit 3e77705

File tree

201 files changed

+779
-414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+779
-414
lines changed

config/findbugs-exclude.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
<!-- Deliberately ignoring return value of CountDownLatch.await -->
3535
<Match>
36-
<Class name="com.mongodb.connection.BaseCluster"/>
36+
<Class name="com.mongodb.internal.connection.BaseCluster"/>
3737
<Bug pattern="RV_RETURN_VALUE_IGNORED"/>
3838
</Match>
3939

@@ -128,7 +128,7 @@
128128
</Match>
129129

130130
<Match>
131-
<Class name="~com.mongodb.connection.AbstractByteBufBsonDocument.*"/>
131+
<Class name="~com.mongodb.internal.connection.AbstractByteBufBsonDocument.*"/>
132132
<Bug pattern="NP_BOOLEAN_RETURN_NULL"/>
133133
</Match>
134134

driver-async/src/test/functional/com/mongodb/async/client/MongoClientSessionSpecification.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import com.mongodb.TransactionOptions
2525
import com.mongodb.WriteConcern
2626
import com.mongodb.async.FutureResultCallback
2727
import com.mongodb.async.SingleResultCallback
28-
import com.mongodb.connection.TestCommandListener
28+
import com.mongodb.internal.connection.TestCommandListener
2929
import com.mongodb.event.CommandStartedEvent
3030
import org.bson.BsonBinarySubType
3131
import org.bson.BsonDocument

driver-async/src/test/functional/com/mongodb/async/client/ReadConcernTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import com.mongodb.ReadConcern;
2121
import com.mongodb.ReadPreference;
2222
import com.mongodb.async.SingleResultCallback;
23-
import com.mongodb.connection.TestCommandListener;
23+
import com.mongodb.internal.connection.TestCommandListener;
2424
import com.mongodb.event.CommandEvent;
2525
import com.mongodb.event.CommandStartedEvent;
2626
import org.bson.BsonDocument;

driver-async/src/test/functional/com/mongodb/async/client/TransactionsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
import com.mongodb.client.model.CreateCollectionOptions;
3030
import com.mongodb.client.test.CollectionHelper;
3131
import com.mongodb.connection.SocketSettings;
32-
import com.mongodb.connection.TestCommandListener;
3332
import com.mongodb.event.CommandEvent;
33+
import com.mongodb.internal.connection.TestCommandListener;
3434
import com.mongodb.lang.Nullable;
3535
import org.bson.BsonArray;
3636
import org.bson.BsonBoolean;

driver-core/src/main/com/mongodb/connection/AsynchronousSocketChannelStreamFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.mongodb.connection;
1818

1919
import com.mongodb.ServerAddress;
20+
import com.mongodb.internal.connection.AsynchronousSocketChannelStream;
2021
import com.mongodb.internal.connection.PowerOfTwoBufferPool;
2122

2223
import java.nio.channels.AsynchronousChannelGroup;

driver-core/src/main/com/mongodb/connection/ConnectionDescription.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,14 @@ public ConnectionDescription(final ConnectionId connectionId, final ServerVersio
9696
}
9797

9898

99-
ConnectionDescription withConnectionId(final ConnectionId connectionId) {
99+
/**
100+
* Creates a new connection description with the set connection id
101+
*
102+
* @param connectionId the connection id
103+
* @return the new connection description
104+
* @since 3.8
105+
*/
106+
public ConnectionDescription withConnectionId(final ConnectionId connectionId) {
100107
notNull("connectionId", connectionId);
101108
return new ConnectionDescription(connectionId, serverVersion, serverType, maxBatchCount, maxDocumentSize, maxMessageSize,
102109
compressors);

driver-core/src/main/com/mongodb/connection/ConnectionId.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ public final class ConnectionId {
4444
* Construct an instance with the given server id.
4545
*
4646
* @param serverId the server id
47+
* @since 3.8
4748
*/
48-
ConnectionId(final ServerId serverId) {
49+
public ConnectionId(final ServerId serverId) {
4950
this(serverId, INCREMENTING_ID.incrementAndGet(), null);
5051
}
5152

@@ -60,7 +61,14 @@ private ConnectionId(final ServerId serverId, final int localValue, final Intege
6061
}
6162
}
6263

63-
ConnectionId withServerValue(final int serverValue) {
64+
/**
65+
* Creates a new connectionId with the set server value
66+
*
67+
* @param serverValue the server value
68+
* @return the new connection id
69+
* @since 3.8
70+
*/
71+
public ConnectionId withServerValue(final int serverValue) {
6472
isTrue("server value is null", this.serverValue == null);
6573
return new ConnectionId(serverId, localValue, serverValue);
6674
}

driver-core/src/main/com/mongodb/connection/DefaultClusterFactory.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
import com.mongodb.event.ClusterListener;
2323
import com.mongodb.event.CommandListener;
2424
import com.mongodb.event.ConnectionPoolListener;
25+
import com.mongodb.internal.connection.ClusterableServerFactory;
26+
import com.mongodb.internal.connection.DefaultClusterableServerFactory;
27+
import com.mongodb.internal.connection.MultiServerCluster;
28+
import com.mongodb.internal.connection.SingleServerCluster;
2529

2630
import java.util.Collections;
2731
import java.util.List;

driver-core/src/main/com/mongodb/connection/QueryResult.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,6 @@ public QueryResult(final MongoNamespace namespace, final List<T> results, final
4949
this.serverAddress = serverAddress;
5050
}
5151

52-
/**
53-
* Construct an instance.
54-
*
55-
* @param namespace the namespace
56-
* @param replyMessage the reply message
57-
* @param address the server address
58-
*/
59-
QueryResult(final MongoNamespace namespace, final ReplyMessage<T> replyMessage, final ServerAddress address) {
60-
this(namespace, replyMessage.getDocuments(), replyMessage.getReplyHeader().getCursorId(), address
61-
);
62-
}
63-
6452
/**
6553
* Gets the namespace.
6654
*

driver-core/src/main/com/mongodb/connection/ServerDescription.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import com.mongodb.annotations.Immutable;
2222
import com.mongodb.annotations.NotThreadSafe;
2323
import com.mongodb.lang.Nullable;
24+
import com.mongodb.internal.connection.DecimalFormatHelper;
25+
import com.mongodb.internal.connection.Time;
2426
import org.bson.types.ObjectId;
2527

2628
import java.util.Collections;
@@ -45,9 +47,21 @@
4547
@Immutable
4648
public class ServerDescription {
4749

48-
static final String MIN_DRIVER_SERVER_VERSION = "2.6";
49-
static final int MIN_DRIVER_WIRE_VERSION = 1;
50-
static final int MAX_DRIVER_WIRE_VERSION = 6;
50+
/**
51+
* The minimum supported driver server version
52+
* @since 3.8
53+
*/
54+
public static final String MIN_DRIVER_SERVER_VERSION = "2.6";
55+
/**
56+
* The minimum supported driver wire version
57+
* @since 3.8
58+
*/
59+
public static final int MIN_DRIVER_WIRE_VERSION = 1;
60+
/**
61+
* The maximum supported driver wire version
62+
* @since 3.8
63+
*/
64+
public static final int MAX_DRIVER_WIRE_VERSION = 6;
5165

5266
private static final int DEFAULT_MAX_DOCUMENT_SIZE = 0x1000000; // 16MB
5367

0 commit comments

Comments
 (0)