How to find the available workflow instances that are running in an AEM instance Programmatically.
You can find the all workflows in your workflow session from the Interface com.adobe.granite.workflow.WorkflowSession
by using Workflow[] workflows = wfSession.getAllWorkflows()
and you can get the workflow state by using Interface com.adobe.granite.workflow.exec.Workflow
getState() method. For more information you can look for the workflow api document.