Skip to content

Commit

Permalink
Upgrade deps of servers
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesChenX committed Dec 10, 2023
1 parent ae93a34 commit 7ac72c2
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 54 deletions.
38 changes: 19 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.4</version>
<version>3.2.0</version>
</parent>

<groupId>im.turms</groupId>
Expand All @@ -31,44 +31,44 @@
<revision>0.10.0-SNAPSHOT</revision>

<!-- Runtime Deps -->
<awssdk.version>2.21.0</awssdk.version>
<awssdk.version>2.21.40</awssdk.version>
<blockhound.version>1.0.8.RELEASE</blockhound.version>
<disruptor.version>4.0.0</disruptor.version>
<eclipse-collections.version>11.1.0</eclipse-collections.version>
<graalvm.version>23.0.1</graalvm.version>
<icu4j.version>73.2</icu4j.version>
<jctools-core.version>4.0.1</jctools-core.version>
<log4j.version>2.20.0</log4j.version>
<protobuf.version>3.24.4</protobuf.version>
<swagger.version>2.2.16</swagger.version>
<swagger-ui.version>5.7.2</swagger-ui.version>
<graalvm.version>23.0.2</graalvm.version>
<icu4j.version>74.1</icu4j.version>
<jctools-core.version>4.0.2</jctools-core.version>
<log4j.version>2.22.0</log4j.version>
<protobuf.version>3.25.1</protobuf.version>
<swagger.version>2.2.19</swagger.version>
<swagger-ui.version>5.10.3</swagger-ui.version>

<!-- Runtime Deps for Testing -->
<jmh.version>1.37</jmh.version>
<testcontainers.version>1.19.1</testcontainers.version>
<testcontainers.version>1.19.3</testcontainers.version>

<!-- Maven plugins -->
<checkstyle.version>10.12.4</checkstyle.version>
<checkstyle.version>10.12.6</checkstyle.version>
<flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version>
<git-commit-id-maven-plugin.version>6.0.0</git-commit-id-maven-plugin.version>
<maven-checkstyle-plugin.version>3.3.0</maven-checkstyle-plugin.version>
<git-commit-id-maven-plugin.version>7.0.0</git-commit-id-maven-plugin.version>
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<!-- spring-boot-starter-parent sets it to "<maven.compiler.release>${java.version}</maven.compiler.release>",
so we set it to empty to not compile with "release" to use Java internal APIs -->
<maven.compiler.release/>
<maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.1.2</maven-failsafe-plugin.version>
<maven-surefire-plugin.version>3.2.2</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.2.2</maven-failsafe-plugin.version>
<!-- TODO: spring-boot-dependencies-3.1.4 use 3.4.1, which doesn't
support Java 21, we can remove this properties when it upgrade-->
<maven-shade-plugin.version>3.5.1</maven-shade-plugin.version>
<os-maven-plugin.version>1.7.1</os-maven-plugin.version>
<protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version>
<spotbugs-maven-plugin.version>4.7.3.5</spotbugs-maven-plugin.version>
<spotless-maven-plugin.version>2.39.0</spotless-maven-plugin.version>
<spotless-maven-plugin.eclipse.version>4.29</spotless-maven-plugin.eclipse.version>
<spring-boot-thin-layout.version>1.0.30.RELEASE</spring-boot-thin-layout.version>
<spotbugs-maven-plugin.version>4.8.1.0</spotbugs-maven-plugin.version>
<spotless-maven-plugin.version>2.41.1</spotless-maven-plugin.version>
<spotless-maven-plugin.eclipse.version>4.30</spotless-maven-plugin.eclipse.version>
<spring-boot-thin-layout.version>1.0.31.RELEASE</spring-boot-thin-layout.version>

<!-- Configs -->
<skipITs>false</skipITs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@

import static com.mongodb.assertions.Assertions.notNull;
import static com.mongodb.internal.async.ErrorHandlingResultCallback.errorHandlingCallback;
import static com.mongodb.internal.operation.CommandOperationHelper.createReadCommandAndExecuteAsync;
import static com.mongodb.internal.operation.AsyncOperationHelper.createReadCommandAndExecuteAsync;
import static com.mongodb.internal.operation.AsyncOperationHelper.decorateReadWithRetriesAsync;
import static com.mongodb.internal.operation.AsyncOperationHelper.withAsyncSourceAndConnection;
import static com.mongodb.internal.operation.CommandOperationHelper.initialRetryState;
import static com.mongodb.internal.operation.CommandOperationHelper.logRetryExecute;
import static com.mongodb.internal.operation.ExplainHelper.asExplainCommand;
import static com.mongodb.internal.operation.OperationHelper.LOGGER;
import static com.mongodb.internal.operation.OperationHelper.canRetryRead;
import static com.mongodb.internal.operation.OperationHelper.cursorDocumentToQueryResult;
import static com.mongodb.internal.operation.OperationHelper.withAsyncSourceAndConnection;
import static com.mongodb.internal.operation.OperationReadConcernHelper.appendReadConcernToCommand;
import static com.mongodb.internal.operation.ServerVersionHelper.MIN_WIRE_VERSION;

Expand Down Expand Up @@ -90,33 +90,33 @@ public void executeAsync(
final SingleResultCallback<AsyncBatchCursor<T>> callback) {
RetryState retryState = initialRetryState(retryReads);
binding.retain();
AsyncCallbackSupplier<AsyncBatchCursor<T>> asyncRead = CommandOperationHelper
.<AsyncBatchCursor<T>>decorateReadWithRetries(retryState, funcCallback -> {
logRetryExecute(retryState);
withAsyncSourceAndConnection(binding::getReadConnectionSource,
false,
funcCallback,
(source, connection, releasingCallback) -> {
if (retryState
.breakAndCompleteIfRetryAnd(
() -> !canRetryRead(source.getServerDescription(),
binding.getSessionContext()),
releasingCallback)) {
return;
}
final SingleResultCallback<AsyncBatchCursor<T>> wrappedCallback =
exceptionTransformingCallback(releasingCallback);
createReadCommandAndExecuteAsync(retryState,
binding,
source,
namespace.getDatabaseName(),
getCommandCreator(binding.getSessionContext()),
CommandResultDocumentCodec.create(decoder, FIRST_BATCH),
asyncTransformer(),
connection,
wrappedCallback);
});
})
AsyncCallbackSupplier<AsyncBatchCursor<T>> asyncRead = decorateReadWithRetriesAsync(
retryState,
binding.getOperationContext(),
(AsyncCallbackSupplier<AsyncBatchCursor<T>>) funcCallback -> withAsyncSourceAndConnection(
binding::getReadConnectionSource,
false,
funcCallback,
(source, connection, releasingCallback) -> {
if (retryState
.breakAndCompleteIfRetryAnd(
() -> !canRetryRead(source.getServerDescription(),
binding.getSessionContext()),
releasingCallback)) {
return;
}
SingleResultCallback<AsyncBatchCursor<T>> wrappedCallback =
exceptionTransformingCallback(releasingCallback);
createReadCommandAndExecuteAsync(retryState,
binding,
source,
namespace.getDatabaseName(),
getCommandCreator(binding.getSessionContext()),
CommandResultDocumentCodec.create(decoder, FIRST_BATCH),
asyncTransformer(),
connection,
wrappedCallback);
}))
.whenComplete(binding::release);
asyncRead.get(errorHandlingCallback(callback, LOGGER));
}
Expand All @@ -125,10 +125,11 @@ private static <T> SingleResultCallback<T> exceptionTransformingCallback(
final SingleResultCallback<T> callback) {
return (result, t) -> {
if (t != null) {
if (t instanceof MongoCommandException e) {
MongoQueryException exception =
new MongoQueryException(e.getResponse(), e.getServerAddress());
callback.onResult(result, exception);
if (t instanceof MongoCommandException commandException) {
callback.onResult(result,
new MongoQueryException(
commandException.getResponse(),
commandException.getServerAddress()));
} else {
callback.onResult(result, t);
}
Expand Down Expand Up @@ -170,7 +171,7 @@ private CommandOperationHelper.CommandCreator getCommandCreator(
};
}

private CommandOperationHelper.CommandReadTransformerAsync<BsonDocument, AsyncBatchCursor<T>> asyncTransformer() {
private AsyncOperationHelper.CommandReadTransformerAsync<BsonDocument, AsyncBatchCursor<T>> asyncTransformer() {
return (result, source, connection) -> {
QueryResult<T> queryResult = cursorDocumentToQueryResult(result.getDocument("cursor"),
connection.getDescription()
Expand Down

0 comments on commit 7ac72c2

Please sign in to comment.