Skip to content

Commit

Permalink
JBTM-3360 ServerLRAFilter is relying on the wrong RESTEasy behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
xstefank authored and ochaloup committed Sep 24, 2020
1 parent ec82270 commit c46bcc0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Expand Up @@ -21,6 +21,7 @@
*/
package io.narayana.lra.client.internal.proxy.nonjaxrs;

import io.narayana.lra.AnnotationResolver;
import io.narayana.lra.logging.LRALogger;
import org.eclipse.microprofile.lra.annotation.AfterLRA;
import org.eclipse.microprofile.lra.annotation.Compensate;
Expand Down
Expand Up @@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package io.narayana.lra.client.internal.proxy.nonjaxrs;
package io.narayana.lra;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
Expand Down
Expand Up @@ -21,6 +21,7 @@
*/
package io.narayana.lra.filter;

import io.narayana.lra.AnnotationResolver;
import io.narayana.lra.Current;
import io.narayana.lra.client.NarayanaLRAClient;
import io.narayana.lra.client.internal.proxy.nonjaxrs.LRAParticipant;
Expand Down Expand Up @@ -117,7 +118,7 @@ public void filter(ContainerRequestContext containerRequestContext) {
Method method = resourceInfo.getResourceMethod();
MultivaluedMap<String, String> headers = containerRequestContext.getHeaders();
LRA.Type type = null;
LRA transactional = method.getDeclaredAnnotation(LRA.class);
LRA transactional = AnnotationResolver.resolveAnnotation(LRA.class, method);
URI lraId;
URI newLRA = null;
Long timeout = null;
Expand Down Expand Up @@ -151,11 +152,11 @@ public void filter(ContainerRequestContext containerRequestContext) {
}
}

boolean endAnnotation = method.isAnnotationPresent(Complete.class)
|| method.isAnnotationPresent(Compensate.class)
|| method.isAnnotationPresent(Leave.class)
|| method.isAnnotationPresent(Status.class)
|| method.isAnnotationPresent(Forget.class);
boolean endAnnotation = AnnotationResolver.isAnnotationPresent(Complete.class, method)
|| AnnotationResolver.isAnnotationPresent(Compensate.class, method)
|| AnnotationResolver.isAnnotationPresent(Leave.class, method)
|| AnnotationResolver.isAnnotationPresent(Status.class, method)
|| AnnotationResolver.isAnnotationPresent(Forget.class, method);

if (headers.containsKey(LRA_HTTP_CONTEXT_HEADER)) {
try {
Expand All @@ -168,7 +169,7 @@ public void filter(ContainerRequestContext containerRequestContext) {
}
}

if (method.isAnnotationPresent(Leave.class)) {
if (AnnotationResolver.isAnnotationPresent(Leave.class, method)) {
// leave the LRA
String compensatorId = getCompensatorId(incommingLRA, containerRequestContext.getUriInfo(), timeout);

Expand Down

0 comments on commit c46bcc0

Please sign in to comment.