Skip to content

Commit dd11570

Browse files
author
ksirigeri
committed
fix for TOMEE-4560
1 parent 9c19210 commit dd11570

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.apache.openejb.ApplicationException;
2121
import org.apache.openejb.BeanContext;
22+
import org.apache.openejb.ContainerType;
2223
import org.apache.openejb.InterfaceType;
2324
import org.apache.openejb.InvalidateReferenceException;
2425
import org.apache.openejb.OpenEJBException;
@@ -35,6 +36,7 @@
3536
import javax.ejb.EJBAccessException;
3637
import javax.ejb.EJBLocalObject;
3738
import javax.ejb.EJBObject;
39+
import javax.ejb.Remove;
3840
import java.io.ObjectStreamException;
3941
import java.lang.reflect.Method;
4042
import java.rmi.AccessException;
@@ -75,7 +77,7 @@ public Object _invoke(final Object p, final Class interfce, final Method m, fina
7577
if (logger.isDebugEnabled()) {
7678
logger.debug("EjbObjectProxyHandler: invoking method " + methodName + " on " + deploymentID + " with identity " + primaryKey);
7779
}
78-
Integer operation = dispatchTable.get(methodName);
80+
Integer operation = getMappedOperation(m);
7981
if (operation != null) {
8082
if (operation == 3) {
8183
if (m.getParameterTypes()[0] != EJBObject.class && m.getParameterTypes()[0] != EJBLocalObject.class) {
@@ -85,7 +87,12 @@ public Object _invoke(final Object p, final Class interfce, final Method m, fina
8587
operation = m.getParameterTypes().length == 0 ? operation : null;
8688
}
8789
}
88-
if (operation == null || !interfaceType.isComponent()) {
90+
91+
92+
boolean isComponentOperation = operation != null && interfaceType.isComponent();
93+
boolean isRemoveOperation = dispatchTable.get("remove").equals(operation) && ContainerType.STATEFUL.equals(this.container.getContainerType());
94+
95+
if (!isComponentOperation && !isRemoveOperation) {
8996
retValue = businessMethod(interfce, m, a, p);
9097
} else {
9198
switch (operation) {
@@ -174,6 +181,14 @@ public Object _invoke(final Object p, final Class interfce, final Method m, fina
174181
}
175182
}
176183

184+
private static Integer getMappedOperation(final Method m) {
185+
Integer opCode = dispatchTable.get(m.getName());
186+
if (opCode == null && m.getDeclaredAnnotation(Remove.class) != null) {
187+
opCode = dispatchTable.get("remove");
188+
}
189+
return opCode;
190+
}
191+
177192
protected Object getEJBHome(final Method method, final Object[] args, final Object proxy) throws Throwable {
178193
checkAuthorization(method);
179194
return getBeanContext().getEJBHome();

0 commit comments

Comments
 (0)