Skip to content

Commit

Permalink
Merge pull request #16140 from mkouba/issue-16130
Browse files Browse the repository at this point in the history
ArC dev mode monitoring - proceed if the container is not available
  • Loading branch information
ebullient authored Mar 31, 2021
2 parents 1fe4ba7 + 3170324 commit 83c20bc
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import javax.interceptor.InvocationContext;

import io.quarkus.arc.Arc;
import io.quarkus.arc.ArcContainer;
import io.quarkus.arc.InjectableBean;
import io.quarkus.arc.ManagedContext;
import io.quarkus.arc.runtime.devconsole.Invocation.Builder;
Expand All @@ -37,7 +38,12 @@ public class InvocationInterceptor {

@AroundInvoke
public Object monitor(InvocationContext context) throws Exception {
ManagedContext requestContext = Arc.container().requestContext();
ArcContainer container = Arc.container();
if (container == null) {
// If the container is not available then just proceed
return context.proceed();
}
ManagedContext requestContext = container.requestContext();
if (requestContext.isActive()) {
InvocationTree tree = invocationTree.get();
return proceed(tree.invocationStarted(bean, context.getMethod(), getKind(context)), context, requestContext, tree);
Expand Down

0 comments on commit 83c20bc

Please sign in to comment.