if (logger.isDebugEnabled()) {
logStoredConnections();
}
Connection connection = null;
if (connections != null && Utils.isNotEmpty(connections.keySet())) {
logger.debug("Checking cache for existing connection for force project:\n "
+ forceProject.getFullLogDisplay() + ", hash = " + forceProject.hashCode());
connection = connections.get(forceProject);
}
if (connection == null) {
connection = storeConnection(forceProject);
} else {
if (logger.isDebugEnabled()) {
logger.debug("Got cached connection");
}
// test connection's session
if (connection.isStale()) {
connection.relogin();
}
// ensure that force options, eg clientid, are set
connection.setClientCallOptions();
}
return connection;
}