Using while-loop instead of wait and notify