use java's lock implementation due to warning