[jboss-cvs] JBossAS SVN: r61681 - in trunk/ejb3/src/main/org/jboss/ejb3: stateless and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Mar 25 14:23:45 EDT 2007
Author: bstansberry at jboss.com
Date: 2007-03-25 14:23:44 -0400 (Sun, 25 Mar 2007)
New Revision: 61681
Modified:
trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusteredProxy.java
trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java
trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessClusteredProxy.java
Log:
[EJBTHREE-881] Clustered proxies pass the partition name as invocation metadata
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java 2007-03-25 18:22:46 UTC (rev 61680)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java 2007-03-25 18:23:44 UTC (rev 61681)
@@ -50,6 +50,8 @@
* Comment
*
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Brian Stansberry
+ *
* @version $Revision$
*/
public class StatefulClusterProxyFactory extends BaseStatefulProxyFactory implements RemoteProxyFactory
@@ -86,9 +88,7 @@
locator = new InvokerLocator(clientBindUrl);
Clustered clustered = (Clustered) advisor.resolveAnnotation(Clustered.class);
if (clustered == null) throw new RuntimeException("Could not find @Clustered annotation. Cannot deploy.");
- // Partition name may be ${jboss.partition.name:DefaultPartition}
- // so do a system property substitution
- String partitionName = substituteSystemProperty(clustered.partition());
+ String partitionName = ((StatefulContainer) container).getPartitionName();
proxyFamilyName = container.getEjbName() + locator.getProtocol() + partitionName;
HAPartition partition = (HAPartition) container.getInitialContext().lookup("/HAPartition/" + partitionName);
hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
@@ -130,7 +130,9 @@
stackName = binding.interceptorStack();
}
AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- Object[] args = {new StatefulClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null), wrapper, lbPolicy)};
+ String partitionName = ((StatefulContainer) container).getPartitionName();
+ Object[] args = {new StatefulClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null),
+ wrapper, lbPolicy, partitionName)};
return proxyConstructor.newInstance(args);
}
catch (InstantiationException e)
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusteredProxy.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusteredProxy.java 2007-03-25 18:22:46 UTC (rev 61680)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusteredProxy.java 2007-03-25 18:23:44 UTC (rev 61681)
@@ -35,37 +35,39 @@
import org.jboss.ejb3.JBossProxy;
import org.jboss.ejb3.ProxyUtils;
import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
+import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor;
import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
import org.jboss.util.id.GUID;
/**
- * Comment
+ * InvocationHandler for a clustered SFSB proxy.
*
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Brian Stansberry
* @version $Revision$
*/
public class StatefulClusteredProxy extends org.jboss.ejb3.remoting.BaseRemoteProxy
-{
- private static final long serialVersionUID = 2702033360945548435L;
+{
+ private static final long serialVersionUID = -1797802577940671292L;
private Object id;
protected FamilyWrapper family;
protected LoadBalancePolicy lbPolicy;
AsynchProvider provider;
+ protected String partitionName;
- public StatefulClusteredProxy(Object containerId, Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lb)
+ public StatefulClusteredProxy(Object containerId, Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lb, String partitionName)
{
super(containerId, interceptors);
this.family = family;
this.lbPolicy = lb;
+ this.partitionName = partitionName;
}
- public StatefulClusteredProxy(AsynchProvider provider, Object containerId, Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lb)
+ public StatefulClusteredProxy(AsynchProvider provider, Object containerId, Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lb, String partitionName)
{
- super(containerId, interceptors);
- this.family = family;
- this.lbPolicy = lb;
+ this(containerId, interceptors, family, lb, partitionName);
this.provider = provider;
}
@@ -95,6 +97,7 @@
sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.AS_IS);
sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.AS_IS);
sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(ClusteredIsLocalInterceptor.PARTITION_NAME, ClusteredIsLocalInterceptor.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT);
if (provider != null)
{
@@ -127,7 +130,7 @@
Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
AsynchMixin mixin = new AsynchMixin();
Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
- StatefulClusteredProxy handler = new StatefulClusteredProxy(mixin, containerId, newInterceptors, family, lbPolicy);
+ StatefulClusteredProxy handler = new StatefulClusteredProxy(mixin, containerId, newInterceptors, family, lbPolicy, partitionName);
return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java 2007-03-25 18:22:46 UTC (rev 61680)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java 2007-03-25 18:23:44 UTC (rev 61681)
@@ -31,6 +31,7 @@
import org.jboss.ejb3.JBossProxy;
import org.jboss.ejb3.ProxyFactoryHelper;
import org.jboss.ejb3.remoting.RemoteProxyFactory;
+import org.jboss.ejb3.stateful.StatefulContainer;
import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
import org.jboss.ha.framework.interfaces.HAPartition;
import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
@@ -79,9 +80,7 @@
locator = new InvokerLocator(clientBindUrl);
Clustered clustered = (Clustered) advisor.resolveAnnotation(Clustered.class);
if (clustered == null) throw new RuntimeException("Could not find @Clustered annotation. Cannot deploy.");
- // Partition name may be ${jboss.partition.name:DefaultPartition}
- // so do a system property substitution
- String partitionName = substituteSystemProperty(clustered.partition());
+ String partitionName = ((StatelessContainer) container).getPartitionName();
proxyFamilyName = container.getEjbName() + locator.getProtocol() + partitionName;
HAPartition partition = (HAPartition) container.getInitialContext().lookup("/HAPartition/" + partitionName);
hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
@@ -121,7 +120,9 @@
Object[] args = {new StatelessClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null), wrapper, lbPolicy)};
return proxyConstructor.newInstance(args);
*/
- return constructProxy(new StatelessClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null), wrapper, lbPolicy));
+ String partitionName = ((StatelessContainer) container).getPartitionName();
+ return constructProxy(new StatelessClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null),
+ wrapper, lbPolicy, partitionName));
}
/*
catch (InstantiationException e)
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessClusteredProxy.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessClusteredProxy.java 2007-03-25 18:22:46 UTC (rev 61680)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessClusteredProxy.java 2007-03-25 18:23:44 UTC (rev 61681)
@@ -37,34 +37,36 @@
import org.jboss.ejb3.ProxyUtils;
import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
import org.jboss.ejb3.remoting.BaseRemoteProxy;
+import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor;
import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
/**
- * Comment
+ * InvocationHandler for a clustered SLSB proxy.
*
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Brian Stansberry
* @version $Revision$
*/
public class StatelessClusteredProxy extends BaseRemoteProxy
-{
- private static final long serialVersionUID = 4266509371275725205L;
-
+{
+ private static final long serialVersionUID = -4100015258079818357L;
+
protected FamilyWrapper family;
protected LoadBalancePolicy lbPolicy;
AsynchProvider provider;
+ protected String partitionName;
- public StatelessClusteredProxy(Object containerId, Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lbPolicy)
+ public StatelessClusteredProxy(Object containerId, Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lbPolicy, String partitionName)
{
super(containerId, interceptors);
this.family = family;
this.lbPolicy = lbPolicy;
+ this.partitionName = partitionName;
}
- public StatelessClusteredProxy(AsynchProvider provider, Object containerId, Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lbPolicy)
+ public StatelessClusteredProxy(AsynchProvider provider, Object containerId, Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lbPolicy, String partitionName)
{
- super(containerId, interceptors);
- this.family = family;
- this.lbPolicy = lbPolicy;
+ this(containerId, interceptors, family, lbPolicy, partitionName);
this.provider = provider;
}
@@ -94,6 +96,7 @@
sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.AS_IS);
sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.AS_IS);
sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(ClusteredIsLocalInterceptor.PARTITION_NAME, ClusteredIsLocalInterceptor.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT);
if (provider != null)
{
@@ -110,7 +113,7 @@
Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
AsynchMixin mixin = new AsynchMixin();
Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
- StatelessClusteredProxy handler = new StatelessClusteredProxy(mixin, containerId, newInterceptors, family, lbPolicy);
+ StatelessClusteredProxy handler = new StatelessClusteredProxy(mixin, containerId, newInterceptors, family, lbPolicy, partitionName);
return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
}
More information about the jboss-cvs-commits
mailing list