[java] minor fix and Lock implementation