synchronized(tasks_all) {
tsk = tasks_all.get(id);
if (tsk == null)
return 0;
}
State st;
synchronized(tsk) {
st = tsk.status_id;
if (State.CANCELED.equals(st))
return tsk.id;
}
if (st.equals(State.CREATED) && subject_id == tsk.initiator_id) {
synchronized(tasks_created) {
tsk = tasks_processing.remove(id);
}
if (tsk != null) {
synchronized(tasks_finished) {
tasks_finished.put(tsk.id, tsk);
}
synchronized(tsk) {
tsk.status_id = State.BROKEN;
}
return tsk.id;
}
}
if (st.equals(State.READY) && subject_id == tsk.initiator_id) {
synchronized(tasks_ready) {
tsk = tasks_processing.remove(id);
}
if (tsk != null) {
synchronized(tasks_finished) {