[jboss-cvs] JBossAS SVN: r69964 - in branches/JBPAPP_4_2_0_GA_CP/ejb3/src: main/org/jboss/ejb3 and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 20 01:27:19 EST 2008
Author: bdecoste
Date: 2008-02-20 01:27:19 -0500 (Wed, 20 Feb 2008)
New Revision: 69964
Modified:
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/annotation/ejb/RemoteBinding.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingImpl.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/StatefulBean.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/unit/MultiBindingsTestCase.java
Log:
[JBPAPP-628] [JBPAPP-629] binding 0.0.0.0 clientBindUrl to correct Connector
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/annotation/ejb/RemoteBinding.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/annotation/ejb/RemoteBinding.java 2008-02-20 05:29:50 UTC (rev 69963)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/annotation/ejb/RemoteBinding.java 2008-02-20 06:27:19 UTC (rev 69964)
@@ -44,6 +44,8 @@
String interceptorStack() default "";
String clientBindUrl() default "";
+
+ String invokerName() default "";
Class factory() default org.jboss.ejb3.remoting.RemoteProxyFactory.class;
}
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingImpl.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingImpl.java 2008-02-20 05:29:50 UTC (rev 69963)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingImpl.java 2008-02-20 06:27:19 UTC (rev 69964)
@@ -40,6 +40,7 @@
private String jndi;
private String stack;
private String bindUrl;
+ private String invokerName;
private Class proxyFactory;
public RemoteBindingImpl()
@@ -47,6 +48,7 @@
jndi = "";
stack = "";
bindUrl = "";
+ invokerName = "";
proxyFactory = org.jboss.ejb3.remoting.RemoteProxyFactory.class;
}
@@ -58,6 +60,15 @@
this.proxyFactory = proxyFactory;
}
+ public RemoteBindingImpl(String jndi, String stack, String bindUrl, String invokerName, Class proxyFactory)
+ {
+ this.jndi = jndi;
+ this.stack = stack;
+ this.bindUrl = bindUrl;
+ this.invokerName = invokerName;
+ this.proxyFactory = proxyFactory;
+ }
+
public void setStack(String stack)
{
this.stack = stack;
@@ -73,6 +84,11 @@
this.jndi = jndi;
}
+ public void setInvokerName(String invokerName)
+ {
+ this.invokerName = invokerName;
+ }
+
public void setBindUrl(String bindUrl)
{
this.bindUrl = bindUrl;
@@ -92,6 +108,11 @@
{
return bindUrl;
}
+
+ public String invokerName()
+ {
+ return invokerName;
+ }
public Class factory()
{
@@ -109,6 +130,9 @@
if (bindUrl.length() == 0)
bindUrl = annotation.clientBindUrl();
+ if (invokerName.length() == 0)
+ invokerName = annotation.invokerName();
+
if (proxyFactory == org.jboss.ejb3.remoting.RemoteProxyFactory.class)
proxyFactory = annotation.factory();
@@ -126,6 +150,7 @@
sb.append(", jndi=" + jndi);
sb.append(", stack=" + stack);
sb.append(", bindUrl=" + bindUrl);
+ sb.append(", invokerName=" + invokerName);
sb.append(", proxyFactory=" + proxyFactory);
sb.append(']');
return sb.toString();
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java 2008-02-20 05:29:50 UTC (rev 69963)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java 2008-02-20 06:27:19 UTC (rev 69964)
@@ -582,15 +582,33 @@
String clientBindUrl = binding.clientBindUrl();
if (clientBindUrl.trim().length() == 0)
{
- ObjectName connectionON = new ObjectName("jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3");
- KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
- try
+ if (binding.invokerName().trim().length() != 0)
{
- clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
+ try
+ {
+ ObjectName connectionON = new ObjectName(binding.invokerName());
+ KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
+ clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to find InvokerLocator " + binding.invokerName() + ". Using default. " + e);
+ clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
+ }
}
- catch (Exception e)
+ else
{
- clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
+ try
+ {
+ ObjectName connectionON = new ObjectName("jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3");
+ KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
+ clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to find default InvokerLocator. Using default. " + e);
+ clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
+ }
}
}
else if (clientBindUrl.indexOf("0.0.0.0") != -1)
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/StatefulBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/StatefulBean.java 2008-02-20 05:29:50 UTC (rev 69963)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/StatefulBean.java 2008-02-20 06:27:19 UTC (rev 69964)
@@ -34,7 +34,8 @@
@Stateful
@RemoteBindings({
@RemoteBinding(clientBindUrl="socket://0.0.0.0:3873", jndiBinding="Stateful3873"),
- @RemoteBinding(clientBindUrl="socket://0.0.0.0:3874", jndiBinding="Stateful3874")
+ @RemoteBinding(clientBindUrl="socket://0.0.0.0:3874", jndiBinding="Stateful3874"),
+ @RemoteBinding(invokerName="jboss.remoting.test:type=Connector,name=Ejbthree994TestEjb3Connector,handler=ejb3", jndiBinding="Stateful3875")
})
@Remote(BusinessInterface.class)
public class StatefulBean implements BusinessInterface
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/unit/MultiBindingsTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/unit/MultiBindingsTestCase.java 2008-02-20 05:29:50 UTC (rev 69963)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/unit/MultiBindingsTestCase.java 2008-02-20 06:27:19 UTC (rev 69964)
@@ -74,6 +74,15 @@
String proxyUri = getProxyUri(bean);
assertEquals(proxyUri, "socket://127.0.0.1:3874/");
}
+
+ {
+ BusinessInterface bean = (BusinessInterface) getInitialContext().lookup("Stateful3875");
+ String actual = bean.echo("789");
+ assertEquals(actual, "*** 789 ***");
+
+ String proxyUri = getProxyUri(bean);
+ assertEquals(proxyUri, "socket://127.0.0.1:3875/");
+ }
}
public static Test suite() throws Exception
More information about the jboss-cvs-commits
mailing list