Author: ataylor
Date: 2011-11-19 04:16:22 -0500 (Sat, 19 Nov 2011)
New Revision: 11723
Modified:
branches/Branch_2_2_AS7/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/ra/HornetQRATestBase.java
branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
Log:
revert classloader change and test fix
Modified:
branches/Branch_2_2_AS7/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
---
branches/Branch_2_2_AS7/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-11-18
22:24:28 UTC (rev 11722)
+++
branches/Branch_2_2_AS7/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-11-19
09:16:22 UTC (rev 11723)
@@ -47,6 +47,7 @@
import org.hornetq.core.cluster.impl.DiscoveryGroupImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.FailureListener;
+import org.hornetq.utils.ClassloadingUtil;
import org.hornetq.utils.HornetQThreadFactory;
import org.hornetq.utils.UUIDGenerator;
@@ -310,6 +311,7 @@
}
+
private void instantiateLoadBalancingPolicy()
{
if (connectionLoadBalancingPolicyClassName == null)
@@ -317,25 +319,7 @@
throw new IllegalStateException("Please specify a load balancing policy
class name on the session factory");
}
- AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- try
- {
- Class<?> clazz =
loader.loadClass(connectionLoadBalancingPolicyClassName);
- loadBalancingPolicy = (ConnectionLoadBalancingPolicy)clazz.newInstance();
- return null;
- }
- catch (Exception e)
- {
- throw new IllegalArgumentException("Unable to instantiate load
balancing policy \"" + connectionLoadBalancingPolicyClassName +
- "\"",
- e);
- }
- }
- });
+ loadBalancingPolicy = (ConnectionLoadBalancingPolicy)
ClassloadingUtil.newInstanceFromClassLoader(connectionLoadBalancingPolicyClassName);
}
private synchronized void initialise() throws HornetQException
Modified:
branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/ra/HornetQRATestBase.java
===================================================================
---
branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/ra/HornetQRATestBase.java 2011-11-18
22:24:28 UTC (rev 11722)
+++
branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/ra/HornetQRATestBase.java 2011-11-19
09:16:22 UTC (rev 11723)
@@ -225,7 +225,7 @@
}
- private static class DummyServiceContainer implements ServiceContainer
+ public static class DummyServiceContainer implements ServiceContainer
{
public void shutdown()
{
Modified:
branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
===================================================================
---
branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java 2011-11-18
22:24:28 UTC (rev 11722)
+++
branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java 2011-11-19
09:16:22 UTC (rev 11723)
@@ -43,6 +43,7 @@
import org.hornetq.core.remoting.impl.invm.InVMConnector;
import org.hornetq.core.remoting.impl.netty.NettyConnector;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.integration.jboss.recovery.AS7RecoveryRegistry;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQDestination;
import org.hornetq.ra.ConnectionFactoryProperties;
@@ -50,6 +51,7 @@
import org.hornetq.ra.HornetQResourceAdapter;
import org.hornetq.ra.inflow.HornetQActivation;
import org.hornetq.ra.inflow.HornetQActivationSpec;
+import org.hornetq.tests.integration.ra.HornetQRATestBase;
import org.hornetq.tests.util.ServiceTestBase;
/**
@@ -465,6 +467,7 @@
ra.setConnectorClassName("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory");
ra.setUserName("userGlobal");
ra.setPassword("passwordGlobal");
+ AS7RecoveryRegistry.container = new HornetQRATestBase.DummyServiceContainer();
ra.start(fakeCTX);
Connection conn = ra.getDefaultHornetQConnectionFactory().createConnection();