1010import java .util .function .Supplier ;
1111import org .slf4j .LoggerFactory ;
1212import software .amazon .lambda .durable .execution .ExecutionManager ;
13- import software .amazon .lambda .durable .execution .ThreadContext ;
14- import software .amazon .lambda .durable .execution .ThreadType ;
1513import software .amazon .lambda .durable .logging .DurableLogger ;
1614import software .amazon .lambda .durable .operation .CallbackOperation ;
1715import software .amazon .lambda .durable .operation .ChildContextOperation ;
@@ -24,7 +22,7 @@ public class DurableContext extends BaseContext {
2422 private final AtomicInteger operationCounter ;
2523 private final DurableLogger logger ;
2624
27- /** Shared initialization — sets all fields but performs no thread registration . */
25+ /** Shared initialization — sets all fields. */
2826 private DurableContext (
2927 ExecutionManager executionManager , DurableConfig durableConfig , Context lambdaContext , String contextId ) {
3028 super (executionManager , durableConfig , lambdaContext , contextId );
@@ -39,7 +37,7 @@ private DurableContext(
3937 }
4038
4139 /**
42- * Creates a root context and registers the current thread for execution coordination.
40+ * Creates a root context (contextId = null)
4341 *
4442 * <p>The context itself always has a null contextId (making it a root context).
4543 *
@@ -50,16 +48,11 @@ private DurableContext(
5048 */
5149 public static DurableContext createRootContext (
5250 ExecutionManager executionManager , DurableConfig durableConfig , Context lambdaContext ) {
53- var ctx = new DurableContext (executionManager , durableConfig , lambdaContext , null );
54- executionManager .registerActiveThread (null );
55- executionManager .setCurrentThreadContext (new ThreadContext (null , ThreadType .CONTEXT ));
56- return ctx ;
51+ return new DurableContext (executionManager , durableConfig , lambdaContext , null );
5752 }
5853
5954 /**
60- * Creates a child context without registering the current thread. Thread registration is handled by
61- * ChildContextOperation, which registers on the parent thread before the executor runs and sets the context on the
62- * child thread inside the executor.
55+ * Creates a child context.
6356 *
6457 * @param childContextId the child context's ID (the CONTEXT operation's operation ID)
6558 * @return a new DurableContext for the child context
0 commit comments