使用double check 读写锁 读多写少场景 记录下
//来源 jdbc 中的查询连接信息
//public abstract class ConnectionUrl implements DatabaseUrlContainer public static ConnectionUrl getConnectionUrlInstance(String connString, Properties info) {if (connString == null) {throw ExceptionFactory.createException(WrongArgumentException.class, Messages.getString("ConnectionString.0"));}String connStringCacheKey = buildConnectionStringCacheKey(connString, info);ConnectionUrl connectionUrl;rwLock.readLock().lock();connectionUrl = connectionUrlCache.get(connStringCacheKey);if (connectionUrl == null) {rwLock.readLock().unlock();rwLock.writeLock().lock();try {// Check again, in the meantime it could have been cached by another thread.connectionUrl = connectionUrlCache.get(connStringCacheKey);if (connectionUrl == null) {ConnectionUrlParser connStrParser = ConnectionUrlParser.parseConnectionString(connString);connectionUrl = Type.getConnectionUrlInstance(connStrParser, info);connectionUrlCache.put(connStringCacheKey, connectionUrl);}rwLock.readLock().lock();} finally {rwLock.writeLock().unlock();}}rwLock.readLock().unlock();return connectionUrl;}