Skip to content

Commit

Permalink
Merge pull request #7440 from svemeyer/update-mongodb-9.2-new
Browse files Browse the repository at this point in the history
pom: Update mongodb-driver
  • Loading branch information
svemeyer authored Nov 30, 2023
2 parents fc02003 + a83cc7f commit 06ddc6e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion modules/dcache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<artifactId>mongodb-driver-sync</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
import static org.dcache.util.Exceptions.messageOrClassName;

import com.google.common.base.Stopwatch;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoClientURI;
import com.mongodb.ConnectionString;
import com.mongodb.MongoClientSettings;
import com.mongodb.MongoException;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.event.ServerClosedEvent;
import com.mongodb.event.ServerDescriptionChangedEvent;
Expand Down Expand Up @@ -130,14 +131,13 @@ public MongoDbMetadataRepository(FileStore fileStore, Path ignored, String poolN

@Override
public void init() throws CacheException {
MongoClientSettings settings = MongoClientSettings.builder()
.applicationName("dCache-" + Version.of(MongoDbMetadataRepository.class).getVersion())
.applyToServerSettings(builder -> builder.addServerListener(this))
.applyConnectionString(new ConnectionString(url))
.build();
mongo = MongoClients.create(settings);

MongoClientOptions.Builder optionBuilder = new MongoClientOptions.Builder()
.addServerListener(this)
.description(pool)
.applicationName(
"dCache-" + Version.of(MongoDbMetadataRepository.class).getVersion());

mongo = new MongoClient(new MongoClientURI(url, optionBuilder));
collection = mongo.getDatabase(dbName).getCollection(collectionName);
}

Expand Down Expand Up @@ -278,7 +278,7 @@ public long getTotalSpace() {

@Override
public String toString() {
return String.format("[data=%s;meta=%s]", fileStore, mongo.getConnectPoint());
return String.format("[data=%s;meta=%s]", fileStore, url);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -832,8 +832,8 @@
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.4.2</version>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.11.1</version>
</dependency>

<dependency>
Expand Down

0 comments on commit 06ddc6e

Please sign in to comment.