|
|
@ -16,17 +16,12 @@ |
|
|
|
|
|
|
|
|
|
|
|
package com.fr.third.springframework.ejb.access; |
|
|
|
package com.fr.third.springframework.ejb.access; |
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
import com.fr.third.springframework.beans.factory.DisposableBean; |
|
|
|
import java.rmi.RemoteException; |
|
|
|
|
|
|
|
import javax.ejb.CreateException; |
|
|
|
|
|
|
|
import javax.ejb.EJBObject; |
|
|
|
|
|
|
|
import javax.naming.NamingException; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.aopalliance.intercept.MethodInvocation; |
|
|
|
import org.aopalliance.intercept.MethodInvocation; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.third.springframework.beans.factory.DisposableBean; |
|
|
|
import javax.ejb.EJBObject; |
|
|
|
import com.fr.third.springframework.remoting.RemoteLookupFailureException; |
|
|
|
import javax.naming.NamingException; |
|
|
|
import com.fr.third.springframework.remoting.rmi.RmiClientInterceptorUtils; |
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Basic invoker for a remote Stateless Session Bean. |
|
|
|
* Basic invoker for a remote Stateless Session Bean. |
|
|
@ -92,32 +87,7 @@ public class SimpleRemoteSlsbInvokerInterceptor extends AbstractRemoteSlsbInvoke |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected Object doInvoke(MethodInvocation invocation) throws Throwable { |
|
|
|
protected Object doInvoke(MethodInvocation invocation) throws Throwable { |
|
|
|
Object ejb = null; |
|
|
|
throw new UnsupportedOperationException(); |
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|