[jboss-cvs] jboss-seam/src/main/org/jboss/seam/interceptors ...
Gavin King
gavin.king at jboss.com
Thu Feb 8 22:44:22 EST 2007
User: gavin
Date: 07/02/08 22:44:22
Modified: src/main/org/jboss/seam/interceptors
AbstractInterceptor.java
AsynchronousInterceptor.java
BijectionInterceptor.java
BusinessProcessInterceptor.java
ConversationInterceptor.java
ConversationalInterceptor.java
OutcomeInterceptor.java RemoveInterceptor.java
RollbackInterceptor.java SecurityInterceptor.java
SynchronizationInterceptor.java
TransactionInterceptor.java
ValidationInterceptor.java
Added: src/main/org/jboss/seam/interceptors
OptimizedInterceptor.java
Log:
optimize interceptor stack, much less stackframes
Revision Changes Path
1.9 +2 -2 jboss-seam/src/main/org/jboss/seam/interceptors/AbstractInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/AbstractInterceptor.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- AbstractInterceptor.java 21 Dec 2006 02:38:27 -0000 1.8
+++ AbstractInterceptor.java 9 Feb 2007 03:44:22 -0000 1.9
@@ -1,4 +1,4 @@
-//$Id: AbstractInterceptor.java,v 1.8 2006/12/21 02:38:27 sbryzak2 Exp $
+//$Id: AbstractInterceptor.java,v 1.9 2007/02/09 03:44:22 gavin Exp $
package org.jboss.seam.interceptors;
import java.io.Serializable;
@@ -10,7 +10,7 @@
*
* @author Gavin King
*/
-public class AbstractInterceptor implements Serializable
+public abstract class AbstractInterceptor implements Serializable, OptimizedInterceptor
{
private static final long serialVersionUID = -8838873111255032911L;
private transient Component component; //a cache of the Component reference
1.10 +5 -1 jboss-seam/src/main/org/jboss/seam/interceptors/AsynchronousInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AsynchronousInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/AsynchronousInterceptor.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- AsynchronousInterceptor.java 21 Dec 2006 02:38:27 -0000 1.9
+++ AsynchronousInterceptor.java 9 Feb 2007 03:44:22 -0000 1.10
@@ -1,5 +1,7 @@
package org.jboss.seam.interceptors;
+
import javax.ejb.Timer;
+
import org.jboss.seam.InterceptorType;
import org.jboss.seam.annotations.AroundInvoke;
import org.jboss.seam.annotations.Asynchronous;
@@ -8,12 +10,14 @@
import org.jboss.seam.core.Dispatcher;
import org.jboss.seam.core.LocalDispatcher;
import org.jboss.seam.intercept.InvocationContext;
+
@Interceptor(type=InterceptorType.CLIENT)
public class AsynchronousInterceptor extends AbstractInterceptor
{
private static final long serialVersionUID = 9194177339867853303L;
+
@AroundInvoke
- public Object invokeAsynchronouslyIfNecessary(InvocationContext invocation) throws Exception
+ public Object aroundInvoke(InvocationContext invocation) throws Exception
{
boolean scheduleAsync = invocation.getMethod().isAnnotationPresent(Asynchronous.class) &&
!Contexts.getEventContext().isSet(Dispatcher.EXECUTING_ASYNCHRONOUS_CALL);
1.28 +2 -2 jboss-seam/src/main/org/jboss/seam/interceptors/BijectionInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BijectionInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/BijectionInterceptor.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- BijectionInterceptor.java 1 Feb 2007 05:03:29 -0000 1.27
+++ BijectionInterceptor.java 9 Feb 2007 03:44:22 -0000 1.28
@@ -1,4 +1,4 @@
-//$Id: BijectionInterceptor.java,v 1.27 2007/02/01 05:03:29 gavin Exp $
+//$Id: BijectionInterceptor.java,v 1.28 2007/02/09 03:44:22 gavin Exp $
package org.jboss.seam.interceptors;
import static org.jboss.seam.util.EJB.POST_ACTIVATE;
@@ -40,7 +40,7 @@
}
@AroundInvoke
- public Object bijectComponent(InvocationContext invocation) throws Exception
+ public Object aroundInvoke(InvocationContext invocation) throws Exception
{
if (reentrant)
{
1.50 +2 -2 jboss-seam/src/main/org/jboss/seam/interceptors/BusinessProcessInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BusinessProcessInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/BusinessProcessInterceptor.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- BusinessProcessInterceptor.java 21 Dec 2006 02:38:27 -0000 1.49
+++ BusinessProcessInterceptor.java 9 Feb 2007 03:44:22 -0000 1.50
@@ -29,7 +29,7 @@
* Interceptor which handles interpretation of jBPM-related annotations.
*
* @author <a href="mailto:steve at hibernate.org">Steve Ebersole </a>
- * @version $Revision: 1.49 $
+ * @version $Revision: 1.50 $
*/
@Interceptor(stateless=true,
around={ValidationInterceptor.class, BijectionInterceptor.class, OutcomeInterceptor.class})
@@ -40,7 +40,7 @@
private static final LogProvider log = Logging.getLogProvider( BusinessProcessInterceptor.class );
@AroundInvoke
- public Object manageBusinessProcessContext(InvocationContext invocation) throws Exception
+ public Object aroundInvoke(InvocationContext invocation) throws Exception
{
if ( !beforeInvocation(invocation) )
{
1.58 +2 -2 jboss-seam/src/main/org/jboss/seam/interceptors/ConversationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ConversationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/ConversationInterceptor.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- ConversationInterceptor.java 21 Dec 2006 02:38:27 -0000 1.57
+++ ConversationInterceptor.java 9 Feb 2007 03:44:22 -0000 1.58
@@ -1,4 +1,4 @@
-//$Id: ConversationInterceptor.java,v 1.57 2006/12/21 02:38:27 sbryzak2 Exp $
+//$Id: ConversationInterceptor.java,v 1.58 2007/02/09 03:44:22 gavin Exp $
package org.jboss.seam.interceptors;
import java.lang.reflect.Method;
@@ -34,7 +34,7 @@
private static final long serialVersionUID = -5405533438107796414L;
@AroundInvoke
- public Object endOrBeginLongRunningConversation(InvocationContext invocation) throws Exception
+ public Object aroundInvoke(InvocationContext invocation) throws Exception
{
Method method = invocation.getMethod();
1.13 +2 -2 jboss-seam/src/main/org/jboss/seam/interceptors/ConversationalInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ConversationalInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/ConversationalInterceptor.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- ConversationalInterceptor.java 21 Dec 2006 02:38:27 -0000 1.12
+++ ConversationalInterceptor.java 9 Feb 2007 03:44:22 -0000 1.13
@@ -1,4 +1,4 @@
-//$Id: ConversationalInterceptor.java,v 1.12 2006/12/21 02:38:27 sbryzak2 Exp $
+//$Id: ConversationalInterceptor.java,v 1.13 2007/02/09 03:44:22 gavin Exp $
package org.jboss.seam.interceptors;
import java.lang.reflect.Method;
@@ -36,7 +36,7 @@
private static final LogProvider log = Logging.getLogProvider(ConversationalInterceptor.class);
@AroundInvoke
- public Object checkConversationForConversationalBean(InvocationContext invocation) throws Exception
+ public Object aroundInvoke(InvocationContext invocation) throws Exception
{
Method method = invocation.getMethod();
1.8 +6 -2 jboss-seam/src/main/org/jboss/seam/interceptors/OutcomeInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OutcomeInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/OutcomeInterceptor.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- OutcomeInterceptor.java 21 Dec 2006 02:38:27 -0000 1.7
+++ OutcomeInterceptor.java 9 Feb 2007 03:44:22 -0000 1.8
@@ -1,11 +1,14 @@
-//$Id: OutcomeInterceptor.java,v 1.7 2006/12/21 02:38:27 sbryzak2 Exp $
+//$Id: OutcomeInterceptor.java,v 1.8 2007/02/09 03:44:22 gavin Exp $
package org.jboss.seam.interceptors;
+
import javax.faces.event.PhaseId;
+
import org.jboss.seam.annotations.AroundInvoke;
import org.jboss.seam.annotations.Interceptor;
import org.jboss.seam.annotations.Outcome;
import org.jboss.seam.contexts.Lifecycle;
import org.jboss.seam.intercept.InvocationContext;
+
/**
* Translates Outcome.RETRY to null for JSF
*
@@ -15,8 +18,9 @@
public class OutcomeInterceptor extends AbstractInterceptor
{
private static final long serialVersionUID = 3964713422043590510L;
+
@AroundInvoke
- public Object interceptOutcome(InvocationContext invocation) throws Exception
+ public Object aroundInvoke(InvocationContext invocation) throws Exception
{
final Object result = invocation.proceed();
return Lifecycle.getPhaseId()==PhaseId.INVOKE_APPLICATION &&
1.20 +2 -2 jboss-seam/src/main/org/jboss/seam/interceptors/RemoveInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: RemoveInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/RemoveInterceptor.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- RemoveInterceptor.java 21 Dec 2006 02:38:27 -0000 1.19
+++ RemoveInterceptor.java 9 Feb 2007 03:44:22 -0000 1.20
@@ -1,4 +1,4 @@
-//$Id: RemoveInterceptor.java,v 1.19 2006/12/21 02:38:27 sbryzak2 Exp $
+//$Id: RemoveInterceptor.java,v 1.20 2007/02/09 03:44:22 gavin Exp $
package org.jboss.seam.interceptors;
import java.lang.reflect.Method;
@@ -29,7 +29,7 @@
private static final LogProvider log = Logging.getLogProvider(RemoveInterceptor.class);
@AroundInvoke
- public Object removeIfNecessary(InvocationContext invocation) throws Exception
+ public Object aroundInvoke(InvocationContext invocation) throws Exception
{
//we have the method from the local interface, get the corresponding one
//for the actual bean class (it has the @Remove annotation)
1.16 +7 -2 jboss-seam/src/main/org/jboss/seam/interceptors/RollbackInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: RollbackInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/RollbackInterceptor.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- RollbackInterceptor.java 21 Dec 2006 02:38:27 -0000 1.15
+++ RollbackInterceptor.java 9 Feb 2007 03:44:22 -0000 1.16
@@ -1,17 +1,21 @@
-//$Id: RollbackInterceptor.java,v 1.15 2006/12/21 02:38:27 sbryzak2 Exp $
+//$Id: RollbackInterceptor.java,v 1.16 2007/02/09 03:44:22 gavin Exp $
package org.jboss.seam.interceptors;
+
import static org.jboss.seam.ComponentType.JAVA_BEAN;
import static org.jboss.seam.util.EJB.APPLICATION_EXCEPTION;
import static org.jboss.seam.util.EJB.rollback;
+
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
+
import org.jboss.seam.annotations.AroundInvoke;
import org.jboss.seam.annotations.Interceptor;
import org.jboss.seam.annotations.Outcome;
import org.jboss.seam.annotations.Rollback;
import org.jboss.seam.intercept.InvocationContext;
import org.jboss.seam.util.Transactions;
+
/**
* Automatically sets transactions to rollback only.
*
@@ -21,8 +25,9 @@
public class RollbackInterceptor extends AbstractInterceptor
{
private static final long serialVersionUID = 5551801508325093417L;
+
@AroundInvoke
- public Object rollbackIfNecessary(InvocationContext invocation) throws Exception
+ public Object aroundInvoke(InvocationContext invocation) throws Exception
{
try
{
1.27 +1 -1 jboss-seam/src/main/org/jboss/seam/interceptors/SecurityInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SecurityInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/SecurityInterceptor.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- SecurityInterceptor.java 4 Feb 2007 01:13:19 -0000 1.26
+++ SecurityInterceptor.java 9 Feb 2007 03:44:22 -0000 1.27
@@ -21,7 +21,7 @@
private static final long serialVersionUID = -6567750187000766925L;
@AroundInvoke
- public Object checkSecurity(InvocationContext invocation) throws Exception
+ public Object aroundInvoke(InvocationContext invocation) throws Exception
{
Restrict r = null;
1.6 +2 -2 jboss-seam/src/main/org/jboss/seam/interceptors/SynchronizationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SynchronizationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/SynchronizationInterceptor.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- SynchronizationInterceptor.java 21 Dec 2006 02:38:27 -0000 1.5
+++ SynchronizationInterceptor.java 9 Feb 2007 03:44:22 -0000 1.6
@@ -1,4 +1,4 @@
-//$Id: SynchronizationInterceptor.java,v 1.5 2006/12/21 02:38:27 sbryzak2 Exp $
+//$Id: SynchronizationInterceptor.java,v 1.6 2007/02/09 03:44:22 gavin Exp $
package org.jboss.seam.interceptors;
import java.util.concurrent.TimeUnit;
@@ -22,7 +22,7 @@
private ReentrantLock lock = new ReentrantLock(true);
@AroundInvoke
- public synchronized Object serialize(InvocationContext invocation) throws Exception
+ public synchronized Object aroundInvoke(InvocationContext invocation) throws Exception
{
if ( lock.tryLock( getComponent().getTimeout(), TimeUnit.MILLISECONDS ) )
{
1.13 +5 -1 jboss-seam/src/main/org/jboss/seam/interceptors/TransactionInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TransactionInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/TransactionInterceptor.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- TransactionInterceptor.java 21 Dec 2006 02:38:27 -0000 1.12
+++ TransactionInterceptor.java 9 Feb 2007 03:44:22 -0000 1.13
@@ -1,11 +1,14 @@
package org.jboss.seam.interceptors;
+
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
+
import org.jboss.seam.annotations.AroundInvoke;
import org.jboss.seam.annotations.Interceptor;
import org.jboss.seam.annotations.Transactional;
import org.jboss.seam.intercept.InvocationContext;
import org.jboss.seam.util.Work;
+
/**
* Implements transaction propagation rules for Seam JavaBean components.
*
@@ -17,8 +20,9 @@
public class TransactionInterceptor extends AbstractInterceptor
{
private static final long serialVersionUID = -4364203056333738988L;
+
@AroundInvoke
- public Object doInTransactionIfNecessary(final InvocationContext invocation) throws Exception
+ public Object aroundInvoke(final InvocationContext invocation) throws Exception
{
return new Work()
{
1.27 +8 -2 jboss-seam/src/main/org/jboss/seam/interceptors/ValidationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ValidationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/ValidationInterceptor.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- ValidationInterceptor.java 21 Dec 2006 02:38:27 -0000 1.26
+++ ValidationInterceptor.java 9 Feb 2007 03:44:22 -0000 1.27
@@ -1,8 +1,11 @@
-//$Id: ValidationInterceptor.java,v 1.26 2006/12/21 02:38:27 sbryzak2 Exp $
+//$Id: ValidationInterceptor.java,v 1.27 2007/02/09 03:44:22 gavin Exp $
package org.jboss.seam.interceptors;
+
import java.lang.reflect.Method;
+
import javax.persistence.Entity;
import javax.persistence.EntityManager;
+
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.hibernate.Session;
@@ -13,6 +16,7 @@
import org.jboss.seam.annotations.Interceptor;
import org.jboss.seam.core.FacesMessages;
import org.jboss.seam.intercept.InvocationContext;
+
/**
* Validate the method receiver using Hibernate validator before
* invoking the method. If a validation failure occurs, put
@@ -30,8 +34,9 @@
private static final long serialVersionUID = 4724500409653141512L;
private static final LogProvider log = Logging.getLogProvider(ValidationInterceptor.class);
+
@AroundInvoke
- public Object validateTargetComponent(InvocationContext invocation) throws Exception
+ public Object aroundInvoke(InvocationContext invocation) throws Exception
{
Method method = invocation.getMethod();
if ( method.isAnnotationPresent(IfInvalid.class) )
@@ -63,6 +68,7 @@
return invocation.proceed();
}
}
+
private void refreshInvalidEntity(IfInvalid ifInvalid, Object entity) {
Object persistenceContext = Component.getInstance( ifInvalid.persistenceContext(), false );
if (persistenceContext==null)
1.1 date: 2007/02/09 03:44:22; author: gavin; state: Exp;jboss-seam/src/main/org/jboss/seam/interceptors/OptimizedInterceptor.java
Index: OptimizedInterceptor.java
===================================================================
package org.jboss.seam.interceptors;
import org.jboss.seam.intercept.InvocationContext;
public interface OptimizedInterceptor
{
public Object aroundInvoke(InvocationContext ic) throws Exception;
}
More information about the jboss-cvs-commits
mailing list