Acquire the lock when getting or setting the value

The lock should be acquired when getting or setting the value, but in getValue() and setValue(V val) the lock wasn't being acquired.

This lack of locking can result in race conditions. I discovered this issue by clearing the GroovyPagesTemplateEngine cache in an infinite loop, which caused page metaclasses to not be removed, resulting in a memory leak.