[jboss-cvs] JBossAS SVN: r82687 - in projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3: service and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 8 02:01:31 EST 2009
Author: ALRubinger
Date: 2009-01-08 02:01:31 -0500 (Thu, 08 Jan 2009)
New Revision: 82687
Removed:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ClassProxyHack.java
Modified:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
Log:
[EJBTHREE-1641] Remove references to old dynamicInvoke(Object,Invocation) through ClassProxyHack in favor of the newer one defined by InvokableContext, cleanup
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java 2009-01-08 06:31:33 UTC (rev 82686)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java 2009-01-08 07:01:31 UTC (rev 82687)
@@ -29,9 +29,7 @@
import org.jboss.aop.util.PayloadKey;
import org.jboss.ejb3.Container;
import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
import org.jboss.logging.Logger;
import org.jboss.serial.io.MarshalledObjectForLocalCalls;
@@ -82,26 +80,10 @@
copy.getMetaData().addMetaData(IS_LOCAL, IS_LOCAL, Boolean.TRUE, PayloadKey.AS_IS);
org.jboss.aop.joinpoint.InvocationResponse response = null;
- /*
- * EJBTHREE-1385
- *
- * Integration of EJB3 Proxy changed the invocation model,
- * so SessionSpecContainers now are supported via
- * dynamicInvoke(Invocation), where all other
- * SessionContainers use the @deprecated
- * dynamicInvoke(Object,Invocation)
- */
- if (container instanceof SessionSpecContainer)
- {
- SessionSpecContainer ssc = (SessionSpecContainer) container;
- response = ssc.dynamicInvoke(copy);
- }
- else
- {
- response = ((SessionContainer) container).dynamicInvoke(null, copy);
- }
+ // Invoke upon the container
+ SessionContainer sc = (SessionContainer) container;
+ response = sc.dynamicInvoke(copy);
-
Map contextInfo = response.getContextInfo();
if (contextInfo != null)
{
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java 2009-01-08 06:31:33 UTC (rev 82686)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java 2009-01-08 07:01:31 UTC (rev 82687)
@@ -42,7 +42,6 @@
import javax.management.MBeanInfo;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.ReflectionException;
@@ -59,7 +58,6 @@
import org.jboss.ejb3.BeanContext;
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.SecurityActions;
import org.jboss.ejb3.annotation.LocalBinding;
import org.jboss.ejb3.annotation.Management;
import org.jboss.ejb3.annotation.RemoteBinding;
@@ -81,7 +79,6 @@
import org.jboss.metadata.ejb.jboss.JBossServiceBeanMetaData;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
-import org.jboss.security.SecurityContext;
import org.jboss.util.NotImplementedException;
@@ -583,13 +580,13 @@
}
}
- @Deprecated
- public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
- {
- log.warn("This call to dynamicInvoke(Object target, Invocation invocation) is "
- + "@Deprecated, should be using dynamicInvoke(Invocation invocation)");
- return this.dynamicInvoke(invocation);
- }
+// @Deprecated
+// public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
+// {
+// log.warn("This call to dynamicInvoke(Object target, Invocation invocation) is "
+// + "@Deprecated, should be using dynamicInvoke(Invocation invocation)");
+// return this.dynamicInvoke(invocation);
+// }
protected void initBeanContext() throws RuntimeException
{
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ClassProxyHack.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ClassProxyHack.java 2009-01-08 06:31:33 UTC (rev 82686)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ClassProxyHack.java 2009-01-08 07:01:31 UTC (rev 82687)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.session;
-
-import org.jboss.aop.InstanceAdvisor;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.InvocationResponse;
-import org.jboss.aop.proxy.ClassProxy;
-import org.jboss.aop.proxy.ProxyMixin;
-
-/**
- * Don't ask. Try observing a volcano eruption from 1 mile or outrun
- * a lightning bolt. It's safer.
- *
- * org.jboss.aop.Dispatcher can handle only certain types.
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-class ClassProxyHack implements ClassProxy
-{
- private SessionContainer container;
-
- ClassProxyHack(SessionContainer container)
- {
- assert container != null : "container is null";
-
- this.container = container;
- }
-
- public InvocationResponse _dynamicInvoke(Invocation invocation) throws Throwable
- {
- return container.dynamicInvoke(null, invocation);
- }
-
- public void setMixins(ProxyMixin[] mixins)
- {
- throw new RuntimeException("Go away, stop bothering me");
- }
-
- public InstanceAdvisor _getInstanceAdvisor()
- {
- throw new RuntimeException("Go away, stop bothering me");
- }
-
- public void _setInstanceAdvisor(InstanceAdvisor newAdvisor)
- {
- throw new RuntimeException("Go away, stop bothering me");
- }
-
-}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java 2009-01-08 06:31:33 UTC (rev 82686)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java 2009-01-08 07:01:31 UTC (rev 82687)
@@ -21,14 +21,11 @@
*/
package org.jboss.ejb3.session;
-import java.lang.reflect.Method;
-
import org.jboss.aop.InstanceAdvisor;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.InvocationResponse;
import org.jboss.aop.proxy.ClassProxy;
import org.jboss.aop.proxy.ProxyMixin;
-import org.jboss.aop.util.MethodHashing;
import org.jboss.ejb3.proxy.container.InvokableContext;
/**
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java 2009-01-08 06:31:33 UTC (rev 82686)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java 2009-01-08 07:01:31 UTC (rev 82687)
@@ -46,6 +46,7 @@
import org.jboss.aop.MethodInfo;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aop.proxy.ClassProxy;
import org.jboss.aop.util.MethodHashing;
import org.jboss.aspects.asynch.FutureHolder;
import org.jboss.ejb3.EJBContainer;
@@ -61,6 +62,7 @@
import org.jboss.ejb3.proxy.ProxyUtils;
import org.jboss.ejb3.proxy.clustered.objectstore.ClusteredObjectStoreBindings;
import org.jboss.ejb3.proxy.clustered.registry.ProxyClusteringRegistry;
+import org.jboss.ejb3.proxy.container.InvokableContext;
import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
import org.jboss.ejb3.proxy.jndiregistrar.JndiSessionRegistrarBase;
@@ -77,7 +79,7 @@
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
* @version $Revision$
*/
-public abstract class SessionContainer extends EJBContainer
+public abstract class SessionContainer extends EJBContainer implements InvokableContext
{
@SuppressWarnings("unused")
private static final Logger log = Logger.getLogger(SessionContainer.class);
@@ -132,7 +134,10 @@
*/
protected abstract org.jboss.ejb3.proxy.factory.session.SessionProxyFactory getProxyFactory(RemoteBinding binding);
- public abstract InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable;
+ /**
+ * Entry point for remoting-based invocations via InvokableContextClassProxyHack
+ */
+ public abstract InvocationResponse dynamicInvoke(Invocation invocation) throws Throwable;
public JBossSessionBeanMetaData getMetaData()
{
@@ -182,12 +187,19 @@
}
/**
- * Registers this Container with Remoting
+ * Registers this Container with Remoting / AOP Dispatcher
*/
protected void registerWithAopDispatcher()
{
+ String registrationName = this.getObjectName().getCanonicalName();
+ ClassProxy classProxy = new InvokableContextClassProxyHack(this);
+
// So that Remoting layer can reference this container easily.
- Dispatcher.singleton.registerTarget(getObjectName().getCanonicalName(), new ClassProxyHack(this));
+ Dispatcher.singleton.registerTarget(registrationName, classProxy);
+
+ // Log
+ log.debug("Registered " + this + " with " + Dispatcher.class.getName() + " via "
+ + InvokableContextClassProxyHack.class.getSimpleName() + " at key " + registrationName);
}
/**
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java 2009-01-08 06:31:33 UTC (rev 82686)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java 2009-01-08 07:01:31 UTC (rev 82687)
@@ -573,23 +573,6 @@
// Use legacy
return this.isHandleMethod(invokingMethod);
}
-
- /**
- * Registers this Container with Remoting / AOP Dispatcher
- */
- @Override
- protected void registerWithAopDispatcher()
- {
- String registrationName = this.getObjectName().getCanonicalName();
- ClassProxy classProxy = new InvokableContextClassProxyHack(this);
-
- // So that Remoting layer can reference this container easily.
- Dispatcher.singleton.registerTarget(registrationName, classProxy);
-
- // Log
- log.debug("Registered " + this + " with " + Dispatcher.class.getName() + " via "
- + InvokableContextClassProxyHack.class.getSimpleName() + " at key " + registrationName);
- }
// ------------------------------------------------------------------------------||
// Lifecycle Methods ------------------------------------------------------------||
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2009-01-08 06:31:33 UTC (rev 82686)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2009-01-08 07:01:31 UTC (rev 82687)
@@ -92,7 +92,6 @@
import org.jboss.injection.JndiPropertyInjector;
import org.jboss.logging.Logger;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.util.NotImplementedException;
/**
@@ -507,9 +506,9 @@
/**
* Remote Invocation entry point, as delegated from
- * ClassProxyHack (Remoting Dispatcher)
+ * InvokableContextClassProxyHack (Remoting Dispatcher)
*/
- //TODO
+ @Override
public InvocationResponse dynamicInvoke(Invocation invocation) throws Throwable
{
/*
@@ -727,124 +726,6 @@
}
}
- @Deprecated
- public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
- {
- throw new NotImplementedException("Should be using dynamicInvoke(Invocation invocation)");
- }
-// /**
-// * This should be a remote invocation call
-// *
-// * @param invocation
-// * @return
-// * @throws Throwable
-// * @deprecated Use dynamicInvoke(Invocation invocation)
-// */
-// @Deprecated
-// public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
-// {
-// long start = System.currentTimeMillis();
-//
-// ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-// EJBContainerInvocation newSi = null;
-// pushEnc();
-// try
-// {
-// Thread.currentThread().setContextClassLoader(classloader);
-// MethodInvocation mi = (MethodInvocation)invocation;
-//
-// MethodInfo info = getAdvisor().getMethodInfo(mi.getMethodHash());
-// if (info == null)
-// {
-// throw new RuntimeException("Could not resolve beanClass method from proxy call " + invocation);
-// }
-// Method unadvisedMethod = info.getUnadvisedMethod();
-//
-//
-// StatefulRemoteInvocation si = (StatefulRemoteInvocation) invocation;
-//
-//
-// InvocationResponse response = null;
-//
-// Object newId = null;
-//
-// try
-// {
-// invokeStats.callIn();
-//
-// if (info != null && unadvisedMethod != null && isHomeMethod(unadvisedMethod))
-// {
-// response = invokeHomeMethod(info, si);
-// }
-// else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
-// {
-// response = invokeEJBObjectMethod(info, si);
-// }
-// else
-// {
-// if (unadvisedMethod.isBridge())
-// {
-// unadvisedMethod = this.getNonBridgeMethod(unadvisedMethod);
-// info = super.getMethodInfo(unadvisedMethod);
-// }
-//
-// if (si.getId() == null)
-// {
-// StatefulBeanContext ctx = getCache().create(null, null);
-// newId = ctx.getId();
-// }
-// else
-// {
-// newId = si.getId();
-// }
-// newSi = new StatefulContainerInvocation(info, newId);
-// newSi.setArguments(si.getArguments());
-// newSi.setMetaData(si.getMetaData());
-// newSi.setAdvisor(getAdvisor());
-//
-// Object rtn = null;
-//
-//
-// rtn = newSi.invokeNext();
-//
-// response = marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
-// if (newId != null) response.addAttachment(StatefulConstants.NEW_ID, newId);
-// }
-// }
-// catch (Throwable throwable)
-// {
-// Throwable exception = throwable;
-// if (newId != null)
-// {
-// exception = new ForwardId(throwable, newId);
-// }
-// Map responseContext = null;
-// if (newSi != null) newSi.getResponseContextInfo();
-// response = marshallException(invocation, exception, responseContext);
-// return response;
-// }
-// finally
-// {
-// if (unadvisedMethod != null)
-// {
-// long end = System.currentTimeMillis();
-// long elapsed = end - start;
-// invokeStats.updateStats(unadvisedMethod, elapsed);
-// }
-//
-// invokeStats.callOut();
-// }
-//
-// return response;
-// }
-// finally
-// {
-// Thread.currentThread().setContextClassLoader(oldLoader);
-// popEnc();
-// }
-// }
-
-
public TimerService getTimerService()
{
throw new UnsupportedOperationException("stateful bean doesn't support TimerService (EJB3 18.2#2)");
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java 2009-01-08 06:31:33 UTC (rev 82686)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java 2009-01-08 07:01:31 UTC (rev 82687)
@@ -393,8 +393,9 @@
/**
* Remote Invocation entry point, as delegated from
- * ClassProxyHack (Remoting Dispatcher)
+ * InvokableContextClassProxyHack (Remoting Dispatcher)
*/
+ @Override
public InvocationResponse dynamicInvoke(Invocation invocation) throws Throwable
{
/*
@@ -517,84 +518,7 @@
Thread.currentThread().setContextClassLoader(originalLoader);
}
}
-
- @Deprecated
- public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
- {
- long start = System.currentTimeMillis();
-
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(classloader);
- MethodInvocation si = (MethodInvocation) invocation;
- MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
- if (info == null)
- {
- throw new RuntimeException("Could not resolve beanClass method from proxy call " + invocation);
- }
-
- Method unadvisedMethod = info.getUnadvisedMethod();
- try
- {
- invokeStats.callIn();
-
- //invokedMethod.push(new SerializableMethod(unadvisedMethod, unadvisedMethod.getClass()));
- Map responseContext = null;
- Object rtn = null;
- if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
- {
- rtn = invokeHomeMethod(info, si);
- }
- else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
- {
- rtn = invokeEJBObjectMethod(info, si);
- }
- else
- {
-
- EJBContainerInvocation newSi = null;
-
- newSi = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
- newSi.setArguments(si.getArguments());
- newSi.setMetaData(si.getMetaData());
- newSi.setAdvisor(getAdvisor());
- try
- {
- rtn = newSi.invokeNext();
- responseContext = newSi.getResponseContextInfo();
- }
- catch (Throwable throwable)
- {
- responseContext = newSi.getResponseContextInfo();
- return marshallException(invocation, throwable, responseContext);
- }
- }
-
- InvocationResponse response = marshallResponse(invocation, rtn, responseContext);
- return response;
- }
- finally
- {
- if (unadvisedMethod != null)
- {
- long end = System.currentTimeMillis();
- long elapsed = end - start;
- invokeStats.updateStats(unadvisedMethod, elapsed);
- }
-
- invokeStats.callOut();
-
- //invokedMethod.pop();
- }
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- }
- }
-
-
+
protected Object invokeEJBObjectMethod(MethodInfo info, MethodInvocation invocation) throws Throwable
{
Method unadvisedMethod = info.getUnadvisedMethod();
More information about the jboss-cvs-commits
mailing list