User: starksm
Date: 01/12/13 19:22:11
Modified: src/main/org/jboss/ejb/plugins Tag: Branch_2_4
MessageDrivenInstanceInterceptor.java
Log:
Integrate changes from 3.0 to improve the MDB/ASF layer. This includes
support for the dead message queue for repeated MDB.onMessage failures.
Revision Changes Path
No revision
No revision
1.3.6.1 +65 -32
jboss/src/main/org/jboss/ejb/plugins/MessageDrivenInstanceInterceptor.java
Index: MessageDrivenInstanceInterceptor.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/MessageDrivenInstanceInterceptor.java,v
retrieving revision 1.3
retrieving revision 1.3.6.1
diff -u -r1.3 -r1.3.6.1
--- MessageDrivenInstanceInterceptor.java 2001/02/28 09:25:40 1.3
+++ MessageDrivenInstanceInterceptor.java 2001/12/14 03:22:10 1.3.6.1
@@ -1,5 +1,5 @@
/*
- * jBoss, the OpenSource EJB server
+ * JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
@@ -7,50 +7,71 @@
package org.jboss.ejb.plugins;
import java.rmi.RemoteException;
+import java.util.Map;
import org.jboss.ejb.Container;
import org.jboss.ejb.MessageDrivenContainer;
import org.jboss.ejb.MethodInvocation;
-import org.jboss.logging.Logger;
+
/**
- * This container acquires the given instance. This must be used after
- * the EnvironmentInterceptor, since acquiring instances requires a proper
- * JNDI environment to be set
- * For MessageDriven Beans, we inherit the StatelessSession for now,
- * since message driven beans is much like them
+ * This container acquires the given instance. This must be used after
+ * the EnvironmentInterceptor, since acquiring instances requires a proper
+ * JNDI environment to be set.
*
- * @see <related>
- * @author Peter Antman ([EMAIL PROTECTED])
- * @author Rickard �berg ([EMAIL PROTECTED])
- * @version $Revision: 1.3 $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Peter Antman</a>.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Jason Dillon</a>
+ * @version $Revision: 1.3.6.1 $
*/
public class MessageDrivenInstanceInterceptor
- extends StatelessSessionInstanceInterceptor
+ extends AbstractInterceptor
{
- protected MessageDrivenContainer container;
+ /** The container for this interceptor. */
+ protected MessageDrivenContainer container;
- public void setContainer(Container container)
+ /**
+ * Set the container for this interceptor.
+ *
+ * @param container A <tt>MessageDrivenContainer</tt>.
+ *
+ * @throws ClassCastException Not a <tt>MessageDrivenContainer</tt>.
+ */
+ public void setContainer(final Container container)
{
- this.container = (MessageDrivenContainer)container;
+ this.container = (MessageDrivenContainer)container;
}
- // Overriden here, since these bastards don't have homes
- public Object invokeHome(MethodInvocation mi)
+ /**
+ * Return the container for this interceptor.
+ *
+ * @return The <tt>MessageDrivenContainer</tt> for this interceptor.
+ */
+ public Container getContainer()
+ {
+ return container;
+ }
+
+ /**
+ * Message driven beans do not have homes.
+ *
+ * @throws Error Not valid for MessageDriven beans.
+ */
+ public Object invokeHome(final MethodInvocation mi)
throws Exception
{
- throw new Error("Not valid for MessageDriven beans");
+ throw new Error("Not valid for MessageDriven beans");
}
- // Interceptor implementation --------------------------------------
-
+
+ // Interceptor implementation --------------------------------------
- public Object invoke(MethodInvocation mi)
+ public Object invoke(final MethodInvocation mi)
throws Exception
{
// Get context
mi.setEnterpriseContext(container.getInstancePool().get());
- // There is no need for synchronization since the instance is always fresh
also there should
- // never be a tx associated with the instance.
+ // There is no need for synchronization since the instance is always
+ // fresh also there should never be a tx associated with the instance.
try
{
@@ -58,22 +79,34 @@
return getNext().invoke(mi);
} catch (RuntimeException e) // Instance will be GC'ed at MI return
{
- mi.setEnterpriseContext(null);
- throw e;
+ mi.setEnterpriseContext(null);
+ throw e;
} catch (RemoteException e) // Instance will be GC'ed at MI return
{
- mi.setEnterpriseContext(null);
- throw e;
+ mi.setEnterpriseContext(null);
+ throw e;
} catch (Error e) // Instance will be GC'ed at MI return
{
- mi.setEnterpriseContext(null);
- throw e;
+ mi.setEnterpriseContext(null);
+ throw e;
} finally
{
- // Return context
- if (mi.getEnterpriseContext() != null)
- container.getInstancePool().free(mi.getEnterpriseContext());
+ // Return context
+ if (mi.getEnterpriseContext() != null)
+ container.getInstancePool().free(mi.getEnterpriseContext());
}
}
+ // Monitorable implementation ------------------------------------
+ public void sample(Object s)
+ {
+ // Just here to because Monitorable request it but will be removed soon
+ }
+ public Map retrieveStatistic()
+ {
+ return null;
+ }
+ public void resetStatistic()
+ {
+ }
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development