Improved locking for InMemoryDataInterface.java