add example of readwritelock for java