used wait and notify