|
|
|
@ -16,17 +16,12 @@
|
|
|
|
|
|
|
|
|
|
package com.fr.third.springframework.ejb.access; |
|
|
|
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
|
import java.rmi.RemoteException; |
|
|
|
|
import javax.ejb.CreateException; |
|
|
|
|
import javax.ejb.EJBObject; |
|
|
|
|
import javax.naming.NamingException; |
|
|
|
|
|
|
|
|
|
import com.fr.third.springframework.beans.factory.DisposableBean; |
|
|
|
|
import org.aopalliance.intercept.MethodInvocation; |
|
|
|
|
|
|
|
|
|
import com.fr.third.springframework.beans.factory.DisposableBean; |
|
|
|
|
import com.fr.third.springframework.remoting.RemoteLookupFailureException; |
|
|
|
|
import com.fr.third.springframework.remoting.rmi.RmiClientInterceptorUtils; |
|
|
|
|
import javax.ejb.EJBObject; |
|
|
|
|
import javax.naming.NamingException; |
|
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Basic invoker for a remote Stateless Session Bean. |
|
|
|
@ -92,32 +87,7 @@ public class SimpleRemoteSlsbInvokerInterceptor extends AbstractRemoteSlsbInvoke
|
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
protected Object doInvoke(MethodInvocation invocation) throws Throwable { |
|
|
|
|
Object ejb = null; |
|
|
|
|
try { |
|
|
|
|
ejb = getSessionBeanInstance(); |
|
|
|
|
return RmiClientInterceptorUtils.invokeRemoteMethod(invocation, ejb); |
|
|
|
|
} |
|
|
|
|
catch (NamingException ex) { |
|
|
|
|
throw new RemoteLookupFailureException("Failed to locate remote EJB [" + getJndiName() + "]", ex); |
|
|
|
|
} |
|
|
|
|
catch (InvocationTargetException ex) { |
|
|
|
|
Throwable targetEx = ex.getTargetException(); |
|
|
|
|
if (targetEx instanceof RemoteException) { |
|
|
|
|
RemoteException rex = (RemoteException) targetEx; |
|
|
|
|
throw RmiClientInterceptorUtils.convertRmiAccessException( |
|
|
|
|
invocation.getMethod(), rex, isConnectFailure(rex), getJndiName()); |
|
|
|
|
} |
|
|
|
|
else if (targetEx instanceof CreateException) { |
|
|
|
|
throw RmiClientInterceptorUtils.convertRmiAccessException( |
|
|
|
|
invocation.getMethod(), targetEx, "Could not create remote EJB [" + getJndiName() + "]"); |
|
|
|
|
} |
|
|
|
|
throw targetEx; |
|
|
|
|
} |
|
|
|
|
finally { |
|
|
|
|
if (ejb instanceof EJBObject) { |
|
|
|
|
releaseSessionBeanInstance((EJBObject) ejb); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
throw new UnsupportedOperationException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|