With this you can get the state:
WorkflowProcessInstance pi = (WorkflowProcessInstance)ksession.getProcessInstance(pid);
And states are:
int STATE_PENDING = 0;
int STATE_ACTIVE = 1;
int STATE_COMPLETED = 2;
int STATE_ABORTED = 3;
int STATE_SUSPENDED = 4;
I don't know if there is any method that makes that, but you can code it easily with this information.
Hope it helps,
Demian