The service you invoked on its own thread must use pub.sync:notify to communicate its results to the parent (spawning) service. The parent service must use pub.sync:wait if it needs to obtain the output of the child service.
If the wait timeout period expires before results are returned, you don’t have a way to see if the spawned thread is still running or if it died silently. That’s why I recommend taking care to not simply throw exceptions in a spawned service but to use notifyOnSuccess / notifyOnError approach.
If your wait timeout period is too short, the parent thread will give up on the child thread that is still happily doing its thing. You can either make the wait period longer or use a repeat statement. So long as you are always notifying correctly, if your results aren’t back you can assume the service is still running.
Of course, you could create some logic in which a spawned thread uses some type of semaphore to indicate it is running, but that sounds like unnecessary complexity.
HTH,
Mark
#webMethods#Integration-Server-and-ESB#Flow-and-Java-services