ARTEMIS-3596 Pass class loader to ServiceLoader.load to fix OSGi issues
This commit is contained in:
parent
ca1accc202
commit
e460bea4b8
|
@ -25,7 +25,7 @@ public class OpenSSLContextFactoryProvider {
|
|||
private static final OpenSSLContextFactory FACTORY;
|
||||
static {
|
||||
OpenSSLContextFactory factoryWithHighestPrio = null;
|
||||
for (OpenSSLContextFactory factory : ServiceLoader.load(OpenSSLContextFactory.class)) {
|
||||
for (OpenSSLContextFactory factory : ServiceLoader.load(OpenSSLContextFactory.class, OpenSSLContextFactoryProvider.class.getClassLoader())) {
|
||||
if (factoryWithHighestPrio == null || factory.getPriority() > factoryWithHighestPrio.getPriority()) {
|
||||
factoryWithHighestPrio = factory;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import javax.net.ssl.SSLContext;
|
|||
public class SSLContextFactoryProvider {
|
||||
private static final SSLContextFactory factory;
|
||||
static {
|
||||
ServiceLoader<SSLContextFactory> loader = ServiceLoader.load(SSLContextFactory.class, Thread.currentThread().getContextClassLoader());
|
||||
ServiceLoader<SSLContextFactory> loader = ServiceLoader.load(SSLContextFactory.class, SSLContextFactoryProvider.class.getClassLoader());
|
||||
final List<SSLContextFactory> factories = new ArrayList<>();
|
||||
loader.forEach(factories::add);
|
||||
if (factories.isEmpty()) {
|
||||
|
|
|
@ -2050,7 +2050,7 @@ public final class JMSBridgeImpl implements JMSBridge {
|
|||
if (registry == null) {
|
||||
for (String locatorClasse : RESOURCE_RECOVERY_CLASS_NAMES) {
|
||||
try {
|
||||
ServiceLoader<ActiveMQRegistry> sl = ServiceLoader.load(ActiveMQRegistry.class);
|
||||
ServiceLoader<ActiveMQRegistry> sl = ServiceLoader.load(ActiveMQRegistry.class, JMSBridgeImpl.class.getClassLoader());
|
||||
if (sl.iterator().hasNext()) {
|
||||
registry = sl.iterator().next();
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public final class RecoveryManager {
|
|||
|
||||
for (String locatorClasse : locatorClasses) {
|
||||
try {
|
||||
ServiceLoader<ActiveMQRegistry> sl = ServiceLoader.load(ActiveMQRegistry.class);
|
||||
ServiceLoader<ActiveMQRegistry> sl = ServiceLoader.load(ActiveMQRegistry.class, RecoveryManager.class.getClassLoader());
|
||||
if (sl.iterator().hasNext()) {
|
||||
registry = sl.iterator().next();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue