synchronized(tasks_all) {
tsk = tasks_all.get(id);
if (tsk == null)
return 0;
}
State st;
synchronized(tsk) {
if (State.DONE_TOUT.equals(tsk.status_id))
return tsk.id;
if ((tsk.processor_id != subject_id) && (tsk.initiator_id != subject_id))
return 0;
if (TypeOfState.LAST.equals(tsk.status_id.getType()))
return 0;
st = tsk.status_id;
tsk.status_id = State.DONE_TOUT;
tsk.notifyAll();
}
if (st.equals(State.BREAKING) || st.equals(State.PROCESSING))
synchronized(tasks_processing) {
tasks_processing.remove(id);
}
else if (st.equals(State.CREATED))
synchronized(tasks_created) {
tasks_created.remove(id);
}
synchronized(tasks_finished) {
tasks_finished.put(tsk.id, tsk);