[jboss-cvs] JBossAS SVN: r95312 - in projects/interceptors/trunk/jboss-interceptor/src: main/java/org/jboss/interceptor/proxy and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 21 11:58:48 EDT 2009
Author: marius.bogoevici
Date: 2009-10-21 11:58:48 -0400 (Wed, 21 Oct 2009)
New Revision: 95312
Modified:
projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptionTypeRegistry.java
projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorMethodHandler.java
projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/InterceptionUtils.java
projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/proxy/InterceptionTest.java
Log:
Add support for correctly handling AroundTimeout
Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptionTypeRegistry.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptionTypeRegistry.java 2009-10-21 15:56:25 UTC (rev 95311)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptionTypeRegistry.java 2009-10-21 15:58:48 UTC (rev 95312)
@@ -36,6 +36,8 @@
private static final Logger LOG = LoggerFactory.getLogger(InterceptionTypeRegistry.class);
private static Map<InterceptionType, Class<? extends Annotation>> interceptionAnnotationClasses;
+ public static Class<? extends Annotation> TIMEOUT_ANNOTATION_CLASS = null;
+
static
{
interceptionAnnotationClasses = new HashMap<InterceptionType, Class<? extends Annotation>>();
@@ -50,6 +52,14 @@
LOG.warn("Class '" + interceptionType.getAnnotationClassName() + "' not found, interception based on it is not enabled" );
}
}
+
+ try
+ {
+ TIMEOUT_ANNOTATION_CLASS = (Class<? extends Annotation>) ReflectionUtils.classForName("javax.ejb.Timeout");
+ } catch (ClassNotFoundException e)
+ {
+ // no-op
+ }
}
public static Collection<InterceptionType> getSupportedInterceptionTypes()
@@ -57,6 +67,11 @@
return interceptionAnnotationClasses.keySet();
}
+ public static boolean supportsTimeoutMethods()
+ {
+ return TIMEOUT_ANNOTATION_CLASS != null;
+ }
+
public static Class<? extends Annotation> getAnnotationClass(InterceptionType interceptionType)
{
return interceptionAnnotationClasses.get(interceptionType);
Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorMethodHandler.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorMethodHandler.java 2009-10-21 15:56:25 UTC (rev 95311)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorMethodHandler.java 2009-10-21 15:58:48 UTC (rev 95312)
@@ -16,6 +16,7 @@
import org.jboss.interceptor.model.InterceptionModel;
import org.jboss.interceptor.model.MethodHolder;
import org.jboss.interceptor.model.InterceptionType;
+import org.jboss.interceptor.model.InterceptionTypeRegistry;
import org.jboss.interceptor.registry.InterceptorClassMetadataRegistry;
import org.jboss.interceptor.util.ReflectionUtils;
import org.jboss.interceptor.util.InterceptionUtils;
@@ -86,7 +87,10 @@
{
if (!org.jboss.interceptor.util.InterceptionUtils.isInterceptionCandidate(thisMethod))
return thisMethod.invoke(target, args);
- return executeInterception(thisMethod, args, InterceptionType.AROUND_INVOKE);
+ if (InterceptionTypeRegistry.supportsTimeoutMethods() && thisMethod.isAnnotationPresent(InterceptionTypeRegistry.TIMEOUT_ANNOTATION_CLASS))
+ return executeInterception(thisMethod, args, InterceptionType.AROUND_TIMEOUT);
+ else
+ return executeInterception(thisMethod, args, InterceptionType.AROUND_INVOKE);
} else
{
if (thisMethod.getName().equals(InterceptionUtils.POST_CONSTRUCT))
Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/InterceptionUtils.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/InterceptionUtils.java 2009-10-21 15:56:25 UTC (rev 95311)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/InterceptionUtils.java 2009-10-21 15:58:48 UTC (rev 95312)
@@ -100,7 +100,7 @@
return false;
}
}
- return !Modifier.isStatic(modifiers);
+ return true;
}
/**
Modified: projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/proxy/InterceptionTest.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/proxy/InterceptionTest.java 2009-10-21 15:56:25 UTC (rev 95311)
+++ projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/proxy/InterceptionTest.java 2009-10-21 15:58:48 UTC (rev 95312)
@@ -246,4 +246,3 @@
}
}
}
-
More information about the jboss-cvs-commits
mailing list