You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by th...@apache.org on 2023/10/10 09:29:19 UTC
[jackrabbit-oak] branch trunk updated: OAK-10475 - Expose the Mongo client connection in MongoDocumentNodeStoreBuilderBase (#1142)
This is an automated email from the ASF dual-hosted git repository.
thomasm pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/trunk by this push:
new 8ef2cf89db OAK-10475 - Expose the Mongo client connection in MongoDocumentNodeStoreBuilderBase (#1142)
8ef2cf89db is described below
commit 8ef2cf89db0b4311876904de2b9373402a295c3e
Author: Nuno Santos <ns...@adobe.com>
AuthorDate: Tue Oct 10 11:29:13 2023 +0200
OAK-10475 - Expose the Mongo client connection in MongoDocumentNodeStoreBuilderBase (#1142)
* Expose the Mongo client connection in MongoDocumentNodeStoreBuilderBase.
* Retrigger CI
---
.../mongo/MongoDocumentNodeStoreBuilderBase.java | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentNodeStoreBuilderBase.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentNodeStoreBuilderBase.java
index dbc972a039..46f6f7decd 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentNodeStoreBuilderBase.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentNodeStoreBuilderBase.java
@@ -47,6 +47,7 @@ public abstract class MongoDocumentNodeStoreBuilderBase<T extends MongoDocumentN
private String uri;
private String name;
private String collectionCompressionType;
+ private MongoClient mongoClient;
/**
* Uses the given information to connect to to MongoDB as backend
@@ -212,6 +213,15 @@ public abstract class MongoDocumentNodeStoreBuilderBase<T extends MongoDocumentN
return mongoStatus;
}
+ /**
+ * Returns the MongoDB client configured in the {@link #setMongoDB(String, String, int)} method.
+ *
+ * @return the client or null if the {@link #setMongoDB(String, String, int)} method hasn't been called.
+ */
+ public MongoClient getMongoClient() {
+ return mongoClient;
+ }
+
long getMaxReplicationLagMillis() {
return maxReplicationLagMillis;
}
@@ -227,16 +237,17 @@ public abstract class MongoDocumentNodeStoreBuilderBase<T extends MongoDocumentN
return newMongoDBConnection(uri, name, mongoClock, socketTimeout, socketKeepAlive);
}
- private T setMongoDB(@NotNull MongoDBConnection client,
+ private T setMongoDB(@NotNull MongoDBConnection mongoDBConnection,
int blobCacheSizeMB) {
- client.checkReadWriteConcern();
- this.mongoStatus = client.getStatus();
+ mongoDBConnection.checkReadWriteConcern();
+ this.mongoClient = mongoDBConnection.getClient();
+ this.mongoStatus = mongoDBConnection.getStatus();
this.documentStoreSupplier = memoize(() -> new MongoDocumentStore(
- client.getClient(), client.getDatabase(), MongoDocumentNodeStoreBuilderBase.this));
+ mongoDBConnection.getClient(), mongoDBConnection.getDatabase(), MongoDocumentNodeStoreBuilderBase.this));
if (this.blobStoreSupplier == null) {
this.blobStoreSupplier = memoize(
- () -> new MongoBlobStore(client.getDatabase(), blobCacheSizeMB * 1024 * 1024L, MongoDocumentNodeStoreBuilderBase.this));
+ () -> new MongoBlobStore(mongoDBConnection.getDatabase(), blobCacheSizeMB * 1024 * 1024L, MongoDocumentNodeStoreBuilderBase.this));
}
return thisBuilder();