X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.simple%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FExecutionScope.java;fp=runtime%2Forg.argeo.slc.support.simple%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FExecutionScope.java;h=7deb9f5788923bef2c6a1368a7664be308cc140d;hb=53146ebdda3a7c0c217c44d395d270a7e9d045be;hp=36d951093a964c18b68fea9f0348a089e1f553ac;hpb=45b0bcfd3d796d586163ed9ca2cd91f6de80bc51;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionScope.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionScope.java index 36d951093..7deb9f578 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionScope.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionScope.java @@ -27,9 +27,25 @@ public class ExecutionScope implements Scope { // if not, we expect objectFactory to produce an ExecutionContext Object obj = objectFactory.getObject(); if (obj instanceof ExecutionContext) { + // Check whether we are in an execution + // FIXME: do it more properly (not static) + // see https://www.argeo.org/bugzilla/show_bug.cgi?id=82 + if (!ExecutionAspect.inModuleExecution.get()) + log + .error("An execution context is being instatiated outside an execution." + + " Please check that your references to execution contexts." + + " This may lead to unexpected behaviour and will be rejected in the future."); + // store the ExecutionContext in the ThreadLocal executionContext.set((ExecutionContext) obj); executionContextBeanName.set(name); + if (log.isDebugEnabled()) { + log.debug("Execution context #" + + executionContext.get().getUuid() + + " instantiated. (beanName=" + + executionContextBeanName.get() + ")"); +// Thread.dumpStack(); + } return obj; } else { throw new SlcException(