Implement reentrantlock for SQL read connections.