Skip to content

Commit 2fdae3b

Browse files
vbabaninstIncMale
andauthored
Mark CSOT feature as Alpha (#1372)
JAVA-5402 Co-authored-by: Valentin Kovalenko <[email protected]>
1 parent dca0278 commit 2fdae3b

File tree

171 files changed

+589
-193
lines changed

Some content is hidden

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

171 files changed

+589
-193
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ almost always be binary compatible with prior minor releases from the same major
5252
Patch 4.x.y increments (such as 4.0.0 -> 4.0.1, 4.1.1 -> 4.1.2, etc) will occur for bug fixes only and will always be binary compatible
5353
with prior patch releases of the same minor release branch.
5454

55+
#### @Alpha
56+
57+
APIs marked with the `@Alpha` annotation are in the early stages of development, subject to incompatible changes,
58+
or even removal, in a future release and may lack some intended features. An APIs bearing `@Alpha` annotation may
59+
contain known issues affecting functionality, performance, and stability. They are also exempt from any compatibility
60+
guarantees made by its containing library.
61+
62+
It is inadvisable for <i>applications</i> to use Alpha APIs in production environments or for <i>libraries</i>
63+
(which get included on users' CLASSPATHs, outside the library developers' control) to depend on these APIs. Alpha APIs
64+
are intended for <b>experimental purposes</b> only.
65+
5566
#### @Beta
5667

5768
APIs marked with the `@Beta` annotation at the class or method level are subject to change. They can be modified in any way, or even

THIRD-PARTY-NOTICES

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ https://github.com/mongodb/mongo-java-driver.
3737
See the License for the specific language governing permissions and
3838
limitations under the License.
3939

40-
3) The following files: Beta.java, UnsignedLongs.java, UnsignedLongsTest.java
40+
3) The following files:
41+
42+
Alpha.java (formerly Beta.java)
43+
Beta.java
44+
UnsignedLongs.java
45+
UnsignedLongsTest.java
4146

4247
Copyright 2010 The Guava Authors
4348
Copyright 2011 The Guava Authors

driver-core/src/main/com/mongodb/AwsCredential.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.mongodb;
1818

1919
import com.mongodb.annotations.Beta;
20+
import com.mongodb.annotations.Reason;
2021
import com.mongodb.lang.Nullable;
2122

2223
import static com.mongodb.assertions.Assertions.notNull;
@@ -28,7 +29,7 @@
2829
* @see MongoCredential#AWS_CREDENTIAL_PROVIDER_KEY
2930
* @since 4.4
3031
*/
31-
@Beta(Beta.Reason.CLIENT)
32+
@Beta(Reason.CLIENT)
3233
public final class AwsCredential {
3334
private final String accessKeyId;
3435
private final String secretAccessKey;

driver-core/src/main/com/mongodb/ClientEncryptionSettings.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
package com.mongodb;
1818

19+
import com.mongodb.annotations.Alpha;
1920
import com.mongodb.annotations.NotThreadSafe;
21+
import com.mongodb.annotations.Reason;
2022
import com.mongodb.lang.Nullable;
2123

2224
import javax.net.ssl.SSLContext;
@@ -159,6 +161,7 @@ public Builder kmsProviderSslContextMap(final Map<String, SSLContext> kmsProvide
159161
* @since CSOT
160162
* @see #getTimeout
161163
*/
164+
@Alpha(Reason.CLIENT)
162165
public ClientEncryptionSettings.Builder timeout(final long timeout, final TimeUnit timeUnit) {
163166
this.timeoutMS = convertAndValidateTimeout(timeout, timeUnit);
164167
return this;
@@ -324,6 +327,7 @@ public Map<String, SSLContext> getKmsProviderSslContextMap() {
324327
* @return the timeout in the given time unit
325328
* @since CSOT
326329
*/
330+
@Alpha(Reason.CLIENT)
327331
@Nullable
328332
public Long getTimeout(final TimeUnit timeUnit) {
329333
return timeoutMS == null ? null : timeUnit.convert(timeoutMS, MILLISECONDS);

driver-core/src/main/com/mongodb/ClientSessionOptions.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616

1717
package com.mongodb;
1818

19+
import com.mongodb.annotations.Alpha;
1920
import com.mongodb.annotations.Immutable;
2021
import com.mongodb.annotations.NotThreadSafe;
22+
import com.mongodb.annotations.Reason;
2123
import com.mongodb.lang.Nullable;
2224
import com.mongodb.session.ClientSession;
2325

@@ -94,6 +96,7 @@ public TransactionOptions getDefaultTransactionOptions() {
9496
* @return the default timeout
9597
* @since CSOT
9698
*/
99+
@Alpha(Reason.CLIENT)
97100
@Nullable
98101
public Long getDefaultTimeout(final TimeUnit timeUnit) {
99102
return defaultTimeoutMS == null ? null : timeUnit.convert(defaultTimeoutMS, MILLISECONDS);
@@ -223,6 +226,7 @@ public Builder defaultTransactionOptions(final TransactionOptions defaultTransac
223226
* @since CSOT
224227
* @see #getDefaultTimeout
225228
*/
229+
@Alpha(Reason.CLIENT)
226230
public Builder defaultTimeout(final long defaultTimeout, final TimeUnit timeUnit) {
227231
this.defaultTimeoutMS = convertAndValidateTimeout(defaultTimeout, timeUnit, "defaultTimeout");
228232
return this;

driver-core/src/main/com/mongodb/ConnectionString.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.mongodb;
1818

19+
import com.mongodb.annotations.Alpha;
20+
import com.mongodb.annotations.Reason;
1921
import com.mongodb.connection.ClusterSettings;
2022
import com.mongodb.connection.ConnectionPoolSettings;
2123
import com.mongodb.connection.ServerMonitoringMode;
@@ -137,7 +139,8 @@
137139
* <li>{@code sslInvalidHostNameAllowed=true|false}: Whether to allow invalid host names for TLS connections.</li>
138140
* <li>{@code tlsAllowInvalidHostnames=true|false}: Whether to allow invalid host names for TLS connections. Supersedes the
139141
* sslInvalidHostNameAllowed option</li>
140-
* <li>{@code timeoutMS=ms}: Time limit for the full execution of an operation.</li>
142+
* <li>{@code timeoutMS=ms}: Time limit for the full execution of an operation. Note: This parameter is part of an {@linkplain Alpha Alpha API} and may be
143+
* subject to changes or even removal in future releases.</li>
141144
* <li>{@code connectTimeoutMS=ms}: How long a connection can take to be opened before timing out.</li>
142145
* <li>{@code socketTimeoutMS=ms}: How long a receive on a socket can take before timing out.
143146
* This option is the same as {@link SocketSettings#getReadTimeout(TimeUnit)}.
@@ -1574,6 +1577,7 @@ public Integer getMaxConnecting() {
15741577
* @return the time limit for the full execution of an operation in milliseconds or null.
15751578
* @since CSOT
15761579
*/
1580+
@Alpha(Reason.CLIENT)
15771581
@Nullable
15781582
public Long getTimeout() {
15791583
return timeout;

driver-core/src/main/com/mongodb/MongoClientSettings.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616

1717
package com.mongodb;
1818

19+
import com.mongodb.annotations.Alpha;
1920
import com.mongodb.annotations.Immutable;
2021
import com.mongodb.annotations.NotThreadSafe;
22+
import com.mongodb.annotations.Reason;
2123
import com.mongodb.client.gridfs.codecs.GridFSFileCodecProvider;
2224
import com.mongodb.client.model.geojson.codecs.GeoJsonCodecProvider;
2325
import com.mongodb.client.model.mql.ExpressionCodecProvider;
@@ -703,6 +705,7 @@ public Builder inetAddressResolver(@Nullable final InetAddressResolver inetAddre
703705
* @since CSOT
704706
* @see #getTimeout
705707
*/
708+
@Alpha(Reason.CLIENT)
706709
public Builder timeout(final long timeout, final TimeUnit timeUnit) {
707710
this.timeoutMS = convertAndValidateTimeout(timeout, timeUnit);
708711
return this;
@@ -915,6 +918,7 @@ public ServerApi getServerApi() {
915918
* @return the timeout in the given time unit
916919
* @since CSOT
917920
*/
921+
@Alpha(Reason.CLIENT)
918922
@Nullable
919923
public Long getTimeout(final TimeUnit timeUnit) {
920924
return timeoutMS == null ? null : timeUnit.convert(timeoutMS, MILLISECONDS);

driver-core/src/main/com/mongodb/MongoCredential.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.mongodb.annotations.Beta;
2020
import com.mongodb.annotations.Immutable;
21+
import com.mongodb.annotations.Reason;
2122
import com.mongodb.lang.Nullable;
2223

2324
import java.util.Arrays;
@@ -176,7 +177,7 @@ public final class MongoCredential {
176177
* @see AwsCredential
177178
* @since 4.4
178179
*/
179-
@Beta(Beta.Reason.CLIENT)
180+
@Beta(Reason.CLIENT)
180181
public static final String AWS_CREDENTIAL_PROVIDER_KEY = "AWS_CREDENTIAL_PROVIDER";
181182

182183
/**

driver-core/src/main/com/mongodb/MongoExecutionTimeoutException.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.mongodb;
1818

19+
import com.mongodb.annotations.Alpha;
20+
import com.mongodb.annotations.Reason;
1921
import org.bson.BsonDocument;
2022

2123
/**
@@ -32,6 +34,7 @@ public class MongoExecutionTimeoutException extends MongoException {
3234
* @param message the error message
3335
* @since CSOT
3436
*/
37+
@Alpha(Reason.CLIENT)
3538
public MongoExecutionTimeoutException(final String message) {
3639
super(message);
3740

driver-core/src/main/com/mongodb/MongoOperationTimeoutException.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616
package com.mongodb;
1717

18+
import com.mongodb.annotations.Alpha;
19+
import com.mongodb.annotations.Reason;
20+
1821
import java.util.concurrent.TimeUnit;
1922

2023
/**
@@ -35,6 +38,7 @@
3538
* @see MongoClientSettings#getTimeout(TimeUnit)
3639
* @since CSOT
3740
*/
41+
@Alpha(Reason.CLIENT)
3842
public final class MongoOperationTimeoutException extends MongoTimeoutException {
3943
private static final long serialVersionUID = 1L;
4044

driver-core/src/main/com/mongodb/MongoSocketWriteTimeoutException.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@
1616

1717
package com.mongodb;
1818

19+
import com.mongodb.annotations.Alpha;
20+
import com.mongodb.annotations.Reason;
21+
1922
/**
2023
* This exception is thrown when there is a timeout writing a response from the socket.
2124
*
2225
* @since CSOT
2326
*/
27+
@Alpha(Reason.CLIENT)
2428
public class MongoSocketWriteTimeoutException extends MongoSocketException {
2529

2630
private static final long serialVersionUID = 1L;

driver-core/src/main/com/mongodb/MongoTimeoutException.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
package com.mongodb;
1818

19+
import com.mongodb.annotations.Alpha;
20+
import com.mongodb.annotations.Reason;
21+
1922
/**
2023
* An exception indicating that the driver has timed out waiting for either a server or a connection to become available.
2124
*/
@@ -38,6 +41,7 @@ public MongoTimeoutException(final String message) {
3841
* @param cause the cause
3942
* @since CSOT
4043
*/
44+
@Alpha(Reason.CLIENT)
4145
public MongoTimeoutException(final String message, final Throwable cause) {
4246
super(message, cause);
4347
}

driver-core/src/main/com/mongodb/MongoUpdatedEncryptedFieldsException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package com.mongodb;
1717

1818
import com.mongodb.annotations.Beta;
19+
import com.mongodb.annotations.Reason;
1920
import org.bson.BsonDocument;
2021

2122
import static com.mongodb.assertions.Assertions.assertNotNull;
@@ -26,7 +27,7 @@
2627
*
2728
* @since 4.9
2829
*/
29-
@Beta(Beta.Reason.SERVER)
30+
@Beta(Reason.SERVER)
3031
public final class MongoUpdatedEncryptedFieldsException extends MongoClientException {
3132
private static final long serialVersionUID = 1;
3233

driver-core/src/main/com/mongodb/TransactionOptions.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
package com.mongodb;
1818

19+
import com.mongodb.annotations.Alpha;
1920
import com.mongodb.annotations.Immutable;
21+
import com.mongodb.annotations.Reason;
2022
import com.mongodb.lang.Nullable;
2123

2224
import java.util.Objects;
@@ -112,6 +114,7 @@ public Long getMaxCommitTime(final TimeUnit timeUnit) {
112114
* @since CSOT
113115
*/
114116
@Nullable
117+
@Alpha(Reason.CLIENT)
115118
public Long getTimeout(final TimeUnit timeUnit) {
116119
notNull("timeUnit", timeUnit);
117120
if (timeoutMS == null) {
@@ -294,6 +297,7 @@ public Builder maxCommitTime(@Nullable final Long maxCommitTime, final TimeUnit
294297
* @return this
295298
* @since CSOT
296299
*/
300+
@Alpha(Reason.CLIENT)
297301
public Builder timeout(@Nullable final Long timeout, final TimeUnit timeUnit) {
298302
this.timeoutMS = convertAndValidateTimeoutNullable(timeout, timeUnit);
299303
return this;
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2008-present MongoDB, Inc.
3+
* Copyright 2010 The Guava Authors
4+
* Copyright 2011 The Guava Authors
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package com.mongodb.annotations;
19+
20+
import java.lang.annotation.Documented;
21+
import java.lang.annotation.ElementType;
22+
import java.lang.annotation.Retention;
23+
import java.lang.annotation.RetentionPolicy;
24+
import java.lang.annotation.Target;
25+
26+
/**
27+
* Signifies that a public API element is in the early stages of development, subject to
28+
* incompatible changes, or even removal, in a future release and may lack some intended features.
29+
* An API bearing this annotation may contain known issues affecting functionality, performance,
30+
* and stability. It is also exempt from any compatibility guarantees made by its containing library.
31+
*
32+
* <p>It is inadvisable for <i>applications</i> to use Alpha APIs in production environments or
33+
* for <i>libraries</i> (which get included on users' CLASSPATHs, outside the library developers'
34+
* control) to depend on these APIs. Alpha APIs are intended for <b>experimental purposes</b> only.</p>
35+
*/
36+
@Retention(RetentionPolicy.CLASS)
37+
@Target({
38+
ElementType.ANNOTATION_TYPE,
39+
ElementType.CONSTRUCTOR,
40+
ElementType.FIELD,
41+
ElementType.METHOD,
42+
ElementType.PACKAGE,
43+
ElementType.TYPE })
44+
@Documented
45+
@Beta(Reason.CLIENT)
46+
public @interface Alpha {
47+
/**
48+
* @return The reason an API element is marked with {@link Alpha}.
49+
*/
50+
Reason[] value();
51+
}

driver-core/src/main/com/mongodb/annotations/Beta.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,10 @@
4747
ElementType.PACKAGE,
4848
ElementType.TYPE })
4949
@Documented
50-
@Beta(Beta.Reason.CLIENT)
50+
@Beta(Reason.CLIENT)
5151
public @interface Beta {
5252
/**
5353
* @return The reason an API element is marked with {@link Beta}.
5454
*/
5555
Reason[] value();
56-
57-
/**
58-
* @see Beta#value()
59-
*/
60-
enum Reason {
61-
/**
62-
* The driver API is in preview.
63-
*/
64-
CLIENT,
65-
/**
66-
* The driver API relies on the server API, which is in preview.
67-
* We still may decide to change the driver API even if the server API stays unchanged.
68-
*/
69-
SERVER
70-
}
7156
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2008-present MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.mongodb.annotations;
18+
19+
/**
20+
* Enumerates the reasons an API element might be marked with annotations like {@link Alpha} or {@link Beta}.
21+
*/
22+
@Beta(Reason.CLIENT)
23+
public enum Reason {
24+
/**
25+
* Indicates that the status of the driver API is the reason for the annotation.
26+
*/
27+
CLIENT,
28+
29+
/**
30+
* The driver API relies on the server API.
31+
* This dependency is the reason for the annotation and suggests that changes in the server API could impact the driver API.
32+
*/
33+
SERVER
34+
}

0 commit comments

Comments
 (0)