Skip to content

Commit

Permalink
changed/removed access to deprecated and removed classes/methods
Browse files Browse the repository at this point in the history
adjusted graalvm substitutions
  • Loading branch information
gcw-it committed Aug 9, 2024
1 parent 2c6d750 commit c71afeb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 54 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
<liquibase-mongodb.version>4.29.0</liquibase-mongodb.version>
<snakeyaml.version>2.2</snakeyaml.version>
<osgi.version>6.0.0</osgi.version>
<mongo-client.version>4.11.1</mongo-client.version>
<mongo-client.version>5.1.3</mongo-client.version>
<mongo-crypt.version>1.11.0</mongo-crypt.version>
<proton-j.version>0.34.1</proton-j.version>
<javaparser.version>3.26.1</javaparser.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,6 @@ public <T> FindPublisher<T> apply(FindPublisher<T> stream) {
if (noCursorTimeout) {
publisher = publisher.noCursorTimeout(true);
}
if (oplogReplay) {
publisher = publisher.oplogReplay(true);
}
if (partial) {
publisher = publisher.partial(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public class MapReduceOptions {
private long maxTime;
private MapReduceAction action;
private String databaseName;
private boolean sharded;
private boolean nonAtomic;
private boolean bypassDocumentValidation;
private Collation collation;

Expand Down Expand Up @@ -159,30 +157,6 @@ public MapReduceOptions databaseName(String databaseName) {
return this;
}

/**
* Sets if the output database is sharded
*
* @param sharded if the output database is sharded
* @return this
*/
public MapReduceOptions sharded(boolean sharded) {
this.sharded = sharded;
return this;
}

/**
* Sets if the post-processing step will prevent MongoDB from locking the database.
* <p>
* Valid only with the {@code MapReduceAction.MERGE} or {@code MapReduceAction.REDUCE} actions.
*
* @param nonAtomic if the post-processing step will prevent MongoDB from locking the database.
* @return this
*/
public MapReduceOptions nonAtomic(boolean nonAtomic) {
this.nonAtomic = nonAtomic;
return this;
}

/**
* Sets the bypass document level validation flag.
*
Expand Down Expand Up @@ -246,8 +220,6 @@ public <T> MapReducePublisher<T> apply(MapReducePublisher<T> stream) {
if (databaseName != null) {
publisher = publisher.databaseName(databaseName);
}
publisher = publisher.sharded(sharded);
publisher = publisher.nonAtomic(nonAtomic);
publisher = publisher.bypassDocumentValidation(bypassDocumentValidation);
if (collation != null) {
publisher = publisher.collation(collation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
import org.eclipse.microprofile.metrics.Tag;

import com.mongodb.connection.ServerId;
import com.mongodb.event.ConnectionAddedEvent;
import com.mongodb.event.ConnectionCheckedInEvent;
import com.mongodb.event.ConnectionCheckedOutEvent;
import com.mongodb.event.ConnectionPoolClosedEvent;
import com.mongodb.event.ConnectionClosedEvent;
import com.mongodb.event.ConnectionCreatedEvent;
import com.mongodb.event.ConnectionPoolCreatedEvent;
import com.mongodb.event.ConnectionPoolListener;
import com.mongodb.event.ConnectionPoolOpenedEvent;
import com.mongodb.event.ConnectionRemovedEvent;

import io.smallrye.metrics.MetricRegistries;

Expand All @@ -23,17 +22,13 @@ public class MongoMetricsConnectionPoolListener implements ConnectionPoolListene
private final static String CHECKED_OUT_COUNT_NAME = "mongodb.connection-pool.checked-out-count";

@Override
public void connectionPoolOpened(ConnectionPoolOpenedEvent event) {
public void connectionPoolCreated(ConnectionPoolCreatedEvent event) {
Tag[] tags = createTags(event.getServerId());

registerGauge(SIZE_NAME, "the current size of the pool, including idle and and in-use members", tags);
registerGauge(CHECKED_OUT_COUNT_NAME, "the current count of connections that are currently in use", tags);
}

@Override
public void connectionPoolClosed(ConnectionPoolClosedEvent event) {
}

@Override
public void connectionCheckedOut(ConnectionCheckedOutEvent event) {
MetricID metricID = createMetricID(CHECKED_OUT_COUNT_NAME, event.getConnectionId().getServerId());
Expand All @@ -57,7 +52,7 @@ public void connectionCheckedIn(ConnectionCheckedInEvent event) {
}

@Override
public void connectionAdded(ConnectionAddedEvent event) {
public void connectionCreated(ConnectionCreatedEvent event) {

MetricID metricID = createMetricID(SIZE_NAME, event.getConnectionId().getServerId());

Expand All @@ -69,7 +64,7 @@ public void connectionAdded(ConnectionAddedEvent event) {
}

@Override
public void connectionRemoved(ConnectionRemovedEvent event) {
public void connectionClosed(ConnectionClosedEvent event) {

MetricID metricID = createMetricID(SIZE_NAME, event.getConnectionId().getServerId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@
import com.mongodb.MongoCompressor;
import com.mongodb.ServerAddress;
import com.mongodb.UnixServerAddress;
import com.mongodb.connection.BufferProvider;
import com.mongodb.connection.SocketSettings;
import com.mongodb.connection.SocketStreamFactory;
import com.mongodb.connection.SslSettings;
import com.mongodb.connection.Stream;
import com.mongodb.internal.connection.BufferProvider;
import com.mongodb.internal.connection.InternalStreamConnection;
import com.mongodb.internal.connection.ServerAddressHelper;
import com.mongodb.internal.connection.SocketStream;
import com.mongodb.internal.connection.SocketStreamFactory;
import com.mongodb.internal.connection.Stream;
import com.mongodb.internal.connection.UnixSocketChannelStream;
import com.mongodb.lang.Nullable;
import com.mongodb.spi.dns.InetAddressResolver;
import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.Delete;
import com.oracle.svm.core.annotate.Substitute;
Expand Down Expand Up @@ -74,25 +75,24 @@ final class UnixServerAddressSubstitution {
@TargetClass(SocketStreamFactory.class)
final class SocketStreamFactorySubstitution {

@Alias
private InetAddressResolver inetAddressResolver;
@Alias
private SocketSettings settings;
@Alias
private SslSettings sslSettings;
@Alias
private SocketFactory socketFactory;
@Alias
private BufferProvider bufferProvider;

@Substitute
public Stream create(final ServerAddress serverAddress) {
Stream stream;
if (socketFactory != null) {
stream = new SocketStream(serverAddress, settings, sslSettings, socketFactory, bufferProvider);
} else if (sslSettings.isEnabled()) {
stream = new SocketStream(serverAddress, settings, sslSettings, getSslContext().getSocketFactory(),
bufferProvider);
if (sslSettings.isEnabled()) {
stream = new SocketStream(serverAddress, inetAddressResolver, settings, sslSettings,
getSslContext().getSocketFactory(), bufferProvider);
} else {
stream = new SocketStream(serverAddress, settings, sslSettings, SocketFactory.getDefault(), bufferProvider);
stream = new SocketStream(serverAddress, inetAddressResolver, settings, sslSettings,
SocketFactory.getDefault(), bufferProvider);
}
return stream;
}
Expand Down

0 comments on commit c71afeb

Please sign in to comment.