My process definition has only custom nodes, with ActionHandlers, all of which have 'leaveNode()' in the 'execute' method. I have a thread T1, which creates new process instances of this definition, and saves them into the context. I tried calling 'signal()' on the instance before saving the instance in the context, but then this causes the T1 to block until the instance either succeeds or fails. Also, if it fails, the exception stack trace includes 'signal()' from T1, and all 'leaveNode()'s that succeeded. I want to decouple inserting the instance, and signaling it for execution, so that T1 can create/insert new instances immediately, and have no knowledge of whether the instance failed or succeeded.
My app is a stand-along java app. I was thinking of having another thread T2, which would pull out these instances and signal them instead. How would it know that a new instance has been created? If I call 'signal()' here, it would block too until the instance completes.
I am looking for a clean and correct way to solve this problem.