@@ -101,6 +101,7 @@ final class SyncWorkflowContext implements WorkflowContext, WorkflowOutboundCall
101
101
102
102
private final String namespace ;
103
103
private final WorkflowExecution workflowExecution ;
104
+ private final SyncWorkflowDefinition workflowDefinition ;
104
105
private final WorkflowImplementationOptions workflowImplementationOptions ;
105
106
private final DataConverter dataConverter ;
106
107
// to be used in this class, should not be passed down. Pass the original #dataConverter instead
@@ -125,15 +126,16 @@ final class SyncWorkflowContext implements WorkflowContext, WorkflowOutboundCall
125
126
private Map <String , NexusServiceOptions > nexusServiceOptionsMap ;
126
127
private boolean readOnly = false ;
127
128
private final WorkflowThreadLocal <UpdateInfo > currentUpdateInfo = new WorkflowThreadLocal <>();
128
- // Map of all running update handlers. Key is the update Id of the update request.
129
+ // Map of all running update handlers. Key is the update ID of the update request.
129
130
private Map <String , UpdateHandlerInfo > runningUpdateHandlers = new HashMap <>();
130
- // Map of all running signal handlers. Key is the event Id of the signal event.
131
+ // Map of all running signal handlers. Key is the event ID of the signal event.
131
132
private Map <Long , SignalHandlerInfo > runningSignalHandlers = new HashMap <>();
132
133
@ Nullable private String currentDetails ;
133
134
134
135
public SyncWorkflowContext (
135
136
@ Nonnull String namespace ,
136
137
@ Nonnull WorkflowExecution workflowExecution ,
138
+ @ Nullable SyncWorkflowDefinition workflowDefinition ,
137
139
SignalDispatcher signalDispatcher ,
138
140
QueryDispatcher queryDispatcher ,
139
141
UpdateDispatcher updateDispatcher ,
@@ -142,6 +144,7 @@ public SyncWorkflowContext(
142
144
List <ContextPropagator > contextPropagators ) {
143
145
this .namespace = namespace ;
144
146
this .workflowExecution = workflowExecution ;
147
+ this .workflowDefinition = workflowDefinition ;
145
148
this .dataConverter = dataConverter ;
146
149
this .dataConverterWithCurrentWorkflowContext =
147
150
dataConverter .withContext (
@@ -1492,6 +1495,11 @@ public void setCurrentDetails(String details) {
1492
1495
currentDetails = details ;
1493
1496
}
1494
1497
1498
+ @ Nullable
1499
+ public Object getInstance () {
1500
+ return workflowDefinition .getInstance ();
1501
+ }
1502
+
1495
1503
@ Nullable
1496
1504
public String getCurrentDetails () {
1497
1505
return currentDetails ;
0 commit comments