used lock in all public methods
checking in test case