Reputation: 14269
I am writing an AWS SWF application using the flow framework. Getting an IllegalStateException: No context Found. It means that the method is called outside of the workflow definition code.
while calling the following code:
private DecisionContextProvider contextProvider
= new DecisionContextProviderImpl();
private WorkflowClock clock
= contextProvider.getDecisionContext().getWorkflowClock();
Why am I getting this error and how to get rid of it?
Upvotes: 1
Views: 1202
Reputation: 16215
This exception is thrown by getDecisionContext()
when you call it outside of a workflow (it should only be called somewhere in the call hierarchy of your workflow implementation - ie, your WorkflowImpl
).
To avoid getting that error, you should only call getDecisionContext()
while inside of a workflow or its constructor. The object only gets set in those circumstances (by the simple workflow framework), and doesn't exist outside of workflow execution, hence the IllegalStateException
.
Upvotes: 1