[jboss-cvs] JBossAS SVN: r110116 - trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 21 22:18:10 EST 2010


Author: marius.bogoevici
Date: 2010-12-21 22:18:10 -0500 (Tue, 21 Dec 2010)
New Revision: 110116

Modified:
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java
Log:
JBAS-8765

Modified: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java	2010-12-21 23:37:53 UTC (rev 110115)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java	2010-12-22 03:18:10 UTC (rev 110116)
@@ -18,10 +18,9 @@
 package org.jboss.weld.integration.ejb.interceptor;
 
 import java.lang.reflect.Method;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
 
 import javax.enterprise.inject.spi.InterceptionType;
 import javax.enterprise.inject.spi.Interceptor;
@@ -32,8 +31,9 @@
 
    private InvocationContext delegateInvocationContext;
 
-   private Queue<Interceptor> invocationQueue;
-   private Queue<Object> interceptorInstances;
+   private List<Interceptor> invocationQueue;
+   private List<Object> interceptorInstances;
+   int position;
 
    private InterceptionType interceptionType;
 
@@ -41,8 +41,9 @@
    {
       this.delegateInvocationContext = delegateInvocationContext;
       this.interceptionType = interceptionType;
-      this.invocationQueue = new ConcurrentLinkedQueue<Interceptor>(interceptors);
-      this.interceptorInstances = new ConcurrentLinkedQueue<Object>(instances);
+      this.invocationQueue = new ArrayList<Interceptor>(interceptors);
+      this.interceptorInstances = new ArrayList<Object>(instances);
+      position = 0;
    }
 
    public Map<String, Object> getContextData()
@@ -67,13 +68,22 @@
 
    public Object proceed() throws Exception
    {
-      if (!invocationQueue.isEmpty())
+      int oldPosition = position;
+      try
       {
-         return invocationQueue.remove().intercept(interceptionType, interceptorInstances.remove(), this);
+         if (position<invocationQueue.size())
+         {
+            Object interceptorInstance = interceptorInstances.get(position);
+            return invocationQueue.get(position++).intercept(interceptionType, interceptorInstance, this);
+         }
+         else
+         {
+            return delegateInvocationContext.proceed();
+         }
       }
-      else
+      finally
       {
-         return delegateInvocationContext.proceed();
+         position = oldPosition;
       }
    }
 



More information about the jboss-cvs-commits mailing list