[jboss-cvs] JBossAS SVN: r68194 - in trunk/ejb3: src/main/org/jboss/ejb3/service and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 12 14:22:28 EST 2007


Author: bdecoste
Date: 2007-12-12 14:22:27 -0500 (Wed, 12 Dec 2007)
New Revision: 68194

Modified:
   trunk/ejb3/build.xml
   trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/session/SessionContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
   trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalHomeProxy.java
   trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxy.java
   trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
   trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
   trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java
Log:
[EJBTHREE-1019] calling local proxies remotely. Limited required client classes.

Modified: trunk/ejb3/build.xml
===================================================================
--- trunk/ejb3/build.xml	2007-12-12 19:22:16 UTC (rev 68193)
+++ trunk/ejb3/build.xml	2007-12-12 19:22:27 UTC (rev 68194)
@@ -344,7 +344,6 @@
             <include name="org/jboss/ejb3/**/*HandleImpl.class"/>
             <include name="org/jboss/ejb3/*Container.class"/>
          	<include name="org/jboss/ejb3/session/SessionContainer.class"/>
-         	<include name="org/jboss/ejb3/stateful/StatefulContainer.class"/>
          	<include name="org/jboss/ejb3/**/*ProxyFactory.class"/>
             <include name="org/jboss/ejb3/proxy/**/*.class"/>
             <include name="org/jboss/ejb3/*ServiceServer*.class"/>

Modified: trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java	2007-12-12 19:22:16 UTC (rev 68193)
+++ trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java	2007-12-12 19:22:27 UTC (rev 68194)
@@ -135,7 +135,7 @@
       return new ServiceRemoteProxyFactory(this, binding);
    }
    
-   protected Object createSession(Class initTypes[], Object initArgs[])
+   public Object createSession(Class initTypes[], Object initArgs[])
    {
 //      if((initTypes != null && initTypes.length > 0) || (initArgs != null && initArgs.length > 0))
 //         throw new IllegalArgumentException("service bean create method must take no arguments");
@@ -308,6 +308,17 @@
    {
       //Ignore
    }
+   
+   public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable
+   {
+      return localInvoke(method, args, provider);
+   }
+   
+   public Object localHomeInvoke(Method method, Object[] args) throws Throwable
+   {
+      // no home interface for Service beans
+      return null;
+   }
 
    /**
     * Performs a synchronous local invocation

Modified: trunk/ejb3/src/main/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/session/SessionContainer.java	2007-12-12 19:22:16 UTC (rev 68193)
+++ trunk/ejb3/src/main/org/jboss/ejb3/session/SessionContainer.java	2007-12-12 19:22:27 UTC (rev 68194)
@@ -445,8 +445,17 @@
     * @param initParameterValues    the arguments for the home's create method
     * @return   the identifier of the session
     */
-   abstract protected Object createSession(Class initParameterTypes[], Object initParameterValues[]);
+   abstract public Object createSession(Class initParameterTypes[], Object initParameterValues[]);
    
+   abstract public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable;
+   
+   abstract public Object localHomeInvoke(Method method, Object[] args) throws Throwable;
+   
+   public Object createSession()
+   {
+      return createSession(null, null);
+   }
+   
    /**
     * Destroy a created session.
     * 

Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java	2007-12-12 19:22:16 UTC (rev 68193)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java	2007-12-12 19:22:27 UTC (rev 68194)
@@ -38,6 +38,7 @@
 import org.jboss.ejb3.annotation.Clustered;
 import org.jboss.ejb3.annotation.RemoteBinding;
 import org.jboss.ejb3.remoting.RemoteProxyFactory;
+import org.jboss.ejb3.session.SessionContainer;
 import org.jboss.ha.client.loadbalance.FirstAvailable;
 import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
 import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
@@ -73,7 +74,7 @@
    private LoadBalancePolicy lbPolicy;
    private FamilyWrapper wrapper;
 
-   public StatefulClusterProxyFactory(StatefulContainer container, RemoteBinding binding, Clustered clustered)
+   public StatefulClusterProxyFactory(SessionContainer container, RemoteBinding binding, Clustered clustered)
    {
       super(container, binding.jndiBinding());
       
@@ -96,12 +97,12 @@
    {
       String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
       locator = new InvokerLocator(clientBindUrl);
-      String partitionName = ((StatefulContainer) getContainer()).getPartitionName();
-      proxyFamilyName = ((StatefulContainer) getContainer()).getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
+      String partitionName = ((SessionContainer) getContainer()).getPartitionName();
+      proxyFamilyName = ((SessionContainer) getContainer()).getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
       HAPartition partition = (HAPartition) getContainer().getInitialContext().lookup("/HAPartition/" + partitionName);
       hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
       ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
-      ((StatefulContainer) getContainer()).getClusterFamilies().put(proxyFamilyName, hatarget);
+      ((SessionContainer) getContainer()).getClusterFamilies().put(proxyFamilyName, hatarget);
       if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(LoadBalancePolicy.class))
       {
          lbPolicy = new FirstAvailable();
@@ -142,7 +143,7 @@
          stackName = binding.interceptorStack();
       }
       AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
-      String partitionName = ((StatefulContainer) getContainer()).getPartitionName();
+      String partitionName = ((SessionContainer) getContainer()).getPartitionName();
       return constructProxy(new StatefulClusteredProxy(getContainer(), stack.createInterceptors((Advisor) getContainer(), null), 
             wrapper, lbPolicy, partitionName));
    }
@@ -157,7 +158,7 @@
       Dispatcher.singleton.unregisterTarget(getTargetId());
       hatarget.destroy();
       drm.unregisterListener(proxyFamilyName, this);
-      ((StatefulContainer) getContainer()).getClusterFamilies().remove(proxyFamilyName);
+      ((SessionContainer) getContainer()).getClusterFamilies().remove(proxyFamilyName);
       Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
       super.stop();
    }
@@ -178,7 +179,7 @@
    protected String getTargetId()
    {
       assert jndiName != null : "jndiName is null";      
-      String partition = ((StatefulContainer) getContainer()).getPartitionName();
+      String partition = ((SessionContainer) getContainer()).getPartitionName();
       return jndiName + PROXY_FACTORY_NAME + "@" + partition;
    }
    

Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java	2007-12-12 19:22:16 UTC (rev 68193)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java	2007-12-12 19:22:27 UTC (rev 68194)
@@ -280,18 +280,13 @@
          popEnc();
       }
    }
-
-   protected Object createSession()
-   {
-      return createSession(null, null);
-   }
    
    /**
     * Create a stateful bean and return its oid.
     *
     * @return
     */
-   protected Object createSession(Class[] initTypes, Object[] initValues)
+   public Object createSession(Class[] initTypes, Object[] initValues)
    {
       ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
       pushEnc();

Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalHomeProxy.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalHomeProxy.java	2007-12-12 19:22:16 UTC (rev 68193)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalHomeProxy.java	2007-12-12 19:22:27 UTC (rev 68194)
@@ -24,6 +24,7 @@
 import java.lang.reflect.Method;
 import org.jboss.ejb3.Container;
 import org.jboss.ejb3.LocalProxy;
+import org.jboss.ejb3.session.SessionContainer;
 
 /**
  * Comment
@@ -48,7 +49,7 @@
    public Object invoke(Object proxy, Method method, Object[] args)
            throws Throwable
    {
-      StatefulContainer sfsb = (StatefulContainer) getContainer();
+      SessionContainer sfsb = (SessionContainer) getContainer();
       return sfsb.localHomeInvoke(method, args);
    }
 

Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxy.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxy.java	2007-12-12 19:22:16 UTC (rev 68193)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxy.java	2007-12-12 19:22:27 UTC (rev 68194)
@@ -38,6 +38,7 @@
 import org.jboss.ejb3.Ejb3Registry;
 import org.jboss.ejb3.LocalProxy;
 import org.jboss.ejb3.ProxyUtils;
+import org.jboss.ejb3.session.SessionContainer;
 import org.jboss.util.id.GUID;
 
 /**
@@ -60,7 +61,7 @@
       super(container);
       this.id = id;
       this.containerGuid = Ejb3Registry.guid(container, vmid);
-      isClustered = ((StatefulContainer)container).isClustered();
+      isClustered = ((SessionContainer)container).isClustered();
    }
 
    public StatefulLocalProxy(AsynchProvider provider, Container container, Object id)
@@ -69,7 +70,7 @@
       this.provider = provider;
       this.id = id;
       this.containerGuid = Ejb3Registry.guid(container);
-      isClustered = ((StatefulContainer)container).isClustered();
+      isClustered = ((SessionContainer)container).isClustered();
    }
 
    public StatefulLocalProxy()
@@ -114,7 +115,7 @@
       if (container == null)
          throw new EJBException("Invalid (i.e. remote) invocation of local interface (null container) for " + containerGuid);
    
-      StatefulContainer sfsb = (StatefulContainer)container;
+      SessionContainer sfsb = (SessionContainer)container;
       return sfsb.localInvoke(id, method, args, (FutureHolder) provider);
    }
 

Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java	2007-12-12 19:22:16 UTC (rev 68193)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java	2007-12-12 19:22:27 UTC (rev 68194)
@@ -65,7 +65,7 @@
 
    protected Class<?>[] getInterfaces()
    {      
-      StatefulContainer statefulContainer = (StatefulContainer) getContainer();
+      SessionContainer statefulContainer = (SessionContainer) getContainer();
       LocalHome localHome = (LocalHome) statefulContainer.resolveAnnotation(LocalHome.class);
 
       boolean bindTogether = false;
@@ -96,7 +96,7 @@
 
    }
    
-   protected boolean bindHomeAndBusinessTogether(StatefulContainer container)
+   protected boolean bindHomeAndBusinessTogether(SessionContainer container)
    {
       return ProxyFactoryHelper.getLocalHomeJndiName(container).equals(jndiName);
    }
@@ -116,7 +116,7 @@
          throw namingException;
       }
 
-      StatefulContainer statefulContainer = (StatefulContainer) getContainer();
+      SessionContainer statefulContainer = (SessionContainer) getContainer();
       LocalHome localHome = (LocalHome) ((EJBContainer) getContainer()).resolveAnnotation(LocalHome.class);
       if (localHome != null && !bindHomeAndBusinessTogether(statefulContainer))
       {
@@ -131,7 +131,7 @@
    {
       super.stop();
       Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
-      StatefulContainer statefulContainer = (StatefulContainer) getContainer();
+      SessionContainer statefulContainer = (SessionContainer) getContainer();
       LocalHome localHome = (LocalHome) ((EJBContainer) getContainer()).resolveAnnotation(LocalHome.class);
       if (localHome != null && !bindHomeAndBusinessTogether(statefulContainer))
       {
@@ -141,10 +141,7 @@
 
    public Object createProxy()
    {
-      StatefulContainer sfsb = (StatefulContainer) getContainer();
-//      StatefulBeanContext ctx = sfsb.getCache().create();
-//      ctx.setInUse(false);
-//      Object id = ctx.getId();
+      SessionContainer sfsb = (SessionContainer) getContainer();
       Object id = sfsb.createSession();
       return constructProxy(new StatefulLocalProxy(getContainer(), id, vmid));
    }
@@ -156,7 +153,7 @@
    
    public Object createProxy(Class[] initTypes, Object[] initValues)
    {
-      StatefulContainer sfsb = (StatefulContainer) getContainer();
+      SessionContainer sfsb = (SessionContainer) getContainer();
       Object id = sfsb.createSession(initTypes, initValues);
       return constructProxy(new StatefulLocalProxy(getContainer(), id, vmid));
    }

Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java	2007-12-12 19:22:16 UTC (rev 68193)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java	2007-12-12 19:22:27 UTC (rev 68194)
@@ -73,7 +73,7 @@
 
    protected Class<?>[] getInterfaces()
    {     
-      StatefulContainer statefulContainer = (StatefulContainer) getContainer();
+      SessionContainer statefulContainer = (SessionContainer) getContainer();
       RemoteHome remoteHome = (RemoteHome) statefulContainer.resolveAnnotation(RemoteHome.class);
 
       boolean bindTogether = false;
@@ -103,7 +103,7 @@
       {});
    }
    
-   protected boolean bindHomeAndBusinessTogether(StatefulContainer container)
+   protected boolean bindHomeAndBusinessTogether(SessionContainer container)
    {
       return ProxyFactoryHelper.getHomeJndiName(container).equals(ProxyFactoryHelper.getRemoteJndiName(container));
    }
@@ -138,7 +138,7 @@
       assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered";
       Dispatcher.singleton.registerTarget(targetId, this);
 
-      StatefulContainer statefulContainer = (StatefulContainer) getContainer();
+      SessionContainer statefulContainer = (SessionContainer) getContainer();
       RemoteHome remoteHome = (RemoteHome) statefulContainer.resolveAnnotation(RemoteHome.class);
       if (remoteHome != null && !bindHomeAndBusinessTogether(statefulContainer))
       {
@@ -154,7 +154,7 @@
       Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
       Dispatcher.singleton.unregisterTarget(getTargetId());
       
-      StatefulContainer statefulContainer = (StatefulContainer) getContainer();
+      SessionContainer statefulContainer = (SessionContainer) getContainer();
       RemoteHome remoteHome = (RemoteHome) statefulContainer.resolveAnnotation(RemoteHome.class);
       if (remoteHome != null && !bindHomeAndBusinessTogether(statefulContainer))
       {

Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java	2007-12-12 19:22:16 UTC (rev 68193)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java	2007-12-12 19:22:27 UTC (rev 68194)
@@ -214,6 +214,11 @@
       return localInvoke(method, args, provider, null);
    }
    
+   public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable
+   {
+      return localInvoke(method, args, provider);
+   }
+   
    public Object localInvoke(Method method, Object[] args, FutureHolder provider, BeanContextLifecycleCallback<StatelessBeanContext> callback) throws Throwable
    {
       long start = System.currentTimeMillis();
@@ -232,7 +237,7 @@
 
             if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
             {
-               return invokeLocalHomeMethod(info, args);
+               return localHomeInvoke(unadvisedMethod, args);
             }
 
             EJBContainerInvocation<StatelessContainer, StatelessBeanContext> nextInvocation = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
@@ -380,10 +385,9 @@
       }
    }
 
-   private Object invokeLocalHomeMethod(MethodInfo info, Object[] args) throws Exception
+   public Object localHomeInvoke(Method method, Object[] args) throws Throwable
    {
-      Method unadvisedMethod = info.getUnadvisedMethod();
-      if (unadvisedMethod.getName().equals("create"))
+      if (method.getName().equals("create"))
       {
          LocalBinding binding = (LocalBinding) resolveAnnotation(LocalBinding.class);
          




More information about the jboss-cvs-commits mailing list