mirror of https://github.com/apache/activemq.git
Load BouncyCastle if present in lib dir. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1480117 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0bb9013769
commit
ff9b80040b
|
@ -24,6 +24,8 @@ import java.io.InputStreamReader;
|
|||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.Provider;
|
||||
import java.security.Security;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
@ -235,6 +237,17 @@ public class BrokerService implements Service {
|
|||
private boolean slave = true;
|
||||
|
||||
static {
|
||||
|
||||
try {
|
||||
ClassLoader loader = BrokerService.class.getClassLoader();
|
||||
Class<?> clazz = loader.loadClass("org.bouncycastle.jce.provider.BouncyCastleProvider");
|
||||
Provider bouncycastle = (Provider) clazz.newInstance();
|
||||
Security.insertProviderAt(bouncycastle, 2);
|
||||
LOG.info("Loaded the Bouncy Castle security provider.");
|
||||
} catch(Throwable e) {
|
||||
// No BouncyCastle found so we use the default Java Security Provider
|
||||
}
|
||||
|
||||
String localHostName = "localhost";
|
||||
try {
|
||||
localHostName = InetAddressUtil.getLocalHostName();
|
||||
|
@ -545,6 +558,7 @@ public class BrokerService implements Service {
|
|||
MDC.put("activemq.broker", brokerName);
|
||||
}
|
||||
}
|
||||
|
||||
// in jvm master slave, lets not publish over existing broker till we get the lock
|
||||
final BrokerRegistry brokerRegistry = BrokerRegistry.getInstance();
|
||||
if (brokerRegistry.lookup(getBrokerName()) == null) {
|
||||
|
|
Loading…
Reference in New Issue