Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 10 additions & 35 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<micrometer.version>1.13.10</micrometer.version>
<opensearch.version>3.3.0</opensearch.version>
<langchain4j.version>1.15.1</langchain4j.version>
<netty.version>4.1.138.Final</netty.version>
<commonmark.version>0.22.0</commonmark.version>
<jsoup.version>1.21.1</jsoup.version>
</properties>
Expand Down Expand Up @@ -100,37 +101,17 @@
<version>3.4.41</version>
</dependency>

<!-- Netty: pin to 4.1.118.Final to resolve conflict between pgjdbc-ng (4.1.63)
and langchain4j-azure-open-ai (4.1.118). Required for DefaultHeaders$ValueValidator. -->
<!-- Netty: import the 4.1.x BOM so every Netty module resolves to a single version.
Left to transitive resolution the trees disagree - azure-core-http-netty brings
4.1.118, reactor-netty brings 4.1.112, netty-codec-http2 brings 4.1.132 and the
awssdk netty-nio-client brings 4.1.130 - which fails at runtime with
NoSuchMethodError, most visibly in DefaultHeaders$ValueValidator. -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
<version>4.1.118.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.118.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
<version>4.1.118.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver</artifactId>
<version>4.1.118.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
<version>4.1.118.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.118.Final</version>
<artifactId>netty-bom</artifactId>
<version>${netty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>


Expand Down Expand Up @@ -847,12 +828,6 @@
</dependency>


<dependency>
<groupId>com.impossibl.pgjdbc-ng</groupId>
<artifactId>pgjdbc-ng</artifactId>
<version>0.8.9</version>
</dependency>

<!--
*****************************
Cluster Support
Expand Down
5 changes: 0 additions & 5 deletions dotCMS/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -712,11 +712,6 @@
</dependency>


<dependency>
<groupId>com.impossibl.pgjdbc-ng</groupId>
<artifactId>pgjdbc-ng</artifactId>
</dependency>

<!--
*****************************
Cluster Support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@

import com.dotmarketing.exception.DotRuntimeException;
import com.dotmarketing.util.Config;
import com.dotmarketing.util.Logger;
import com.google.common.annotations.VisibleForTesting;
import io.vavr.Lazy;
import io.vavr.control.Try;

/**
* Resolves the {@link DotPubSubProvider} used to broadcast cache and cluster events.
* <p>
* The default is {@link JDBCPubSubImpl}. It can be replaced by setting the
* {@code DOT_PUBSUB_PROVIDER_OVERRIDE} system property or config property to the fully qualified
* name of an alternative implementation, for example {@code RedisPubSubImpl}.
* <p>
* If the configured class cannot be loaded or constructed - for instance because it belongs to a
* dependency that is no longer shipped - the default provider is used instead and a warning is
* logged. A stale override therefore degrades to the built-in behaviour rather than preventing
* the node from starting.
*/
public class DotPubSubProviderLocator {

public final static String DOT_PUBSUB_PROVIDER_OVERRIDE = "DOT_PUBSUB_PROVIDER_OVERRIDE";
public final static String DOT_PUBSUB_USE_QUEUE = "DOT_PUBSUB_USE_QUEUE";

/**
* Default provider is JDBCPubSubImpl, can be overriden by setting config: DOT_PUBSUB_PROVIDER_OVERRIDE
* DOT_PUBSUB_USE_QUEUE is a boolean, and will wrap the Pubsub in a queue
Expand All @@ -24,11 +39,67 @@ public class DotPubSubProviderLocator {
: Config.getStringProperty(DOT_PUBSUB_PROVIDER_OVERRIDE,
JDBCPubSubImpl.class.getCanonicalName());

DotPubSubProvider provider = (DotPubSubProvider) Try.of(() -> Class.forName(pubsubClazz).newInstance())
.getOrElseThrow(e -> new DotRuntimeException(e));
final DotPubSubProvider provider = resolveProvider(pubsubClazz);

return (useQueue) ? new QueuingPubSubWrapper(provider) : provider;

});

/**
* Resolves the provider named by {@code DOT_PUBSUB_PROVIDER_OVERRIDE}, falling back to
* {@link JDBCPubSubImpl} when that class is unavailable.
*
* @param pubsubClazz fully qualified name of the requested provider implementation
* @return the resolved provider
* @throws DotRuntimeException if neither the requested nor the default provider can be created
*/
private static DotPubSubProvider resolveProvider(final String pubsubClazz) {
return resolveProvider(pubsubClazz, JDBCPubSubImpl.class.getCanonicalName());
}

/**
* Resolves the provider named by {@code pubsubClazz}, falling back to {@code defaultClazz} when
* the requested class is missing, exposes no no-arg constructor, throws from its constructor, or
* does not implement {@link DotPubSubProvider}.
* <p>
* A failure to build the <em>default</em> provider is not recoverable and is rethrown, since
* there is nothing left to fall back to.
*
* @param pubsubClazz fully qualified name of the requested provider implementation
* @param defaultClazz fully qualified name of the provider to fall back to
* @return the resolved provider
* @throws DotRuntimeException if the fallback (or an explicitly requested default) is unusable
*/
@VisibleForTesting
static DotPubSubProvider resolveProvider(final String pubsubClazz, final String defaultClazz) {

final Try<DotPubSubProvider> configured = Try.of(() -> newProviderInstance(pubsubClazz));

if (configured.isSuccess() || defaultClazz.equals(pubsubClazz)) {
return configured.getOrElseThrow(DotRuntimeException::new);
}

Logger.warn(DotPubSubProviderLocator.class,
() -> "Unable to instantiate DOT_PUBSUB_PROVIDER_OVERRIDE '" + pubsubClazz
+ "', falling back to " + defaultClazz,
configured.getCause());

return Try.of(() -> newProviderInstance(defaultClazz))
.getOrElseThrow(DotRuntimeException::new);
}

/**
* Creates a provider from its fully qualified class name.
*
* @param className fully qualified name of the provider implementation
* @return a new provider instance
* @throws ReflectiveOperationException if the class is missing, has no no-arg constructor, or
* the constructor itself fails
* @throws ClassCastException if the class does not implement {@link DotPubSubProvider}
*/
private static DotPubSubProvider newProviderInstance(final String className)
throws ReflectiveOperationException {
return (DotPubSubProvider) Class.forName(className).getDeclaredConstructor().newInstance();
}

}
89 changes: 0 additions & 89 deletions dotCMS/src/main/java/com/dotcms/dotpubsub/PgNgDataSourceUrl.java

This file was deleted.

Loading
Loading