/** * Retrieve the current target {@link ConnectionFactory}. Determines the * {@link #determineCurrentLookupKey() current lookup key}, performs * a lookup in the {@link #targetConnectionFactories} map, * falls back to the specified * {@link #defaultTargetConnectionFactory} if necessary. * @return The connection factory. * @see #determineCurrentLookupKey() */ protected ConnectionFactory determineTargetConnectionFactory() { Object lookupKey = determineCurrentLookupKey(); ConnectionFactory connectionFactory = null; if (lookupKey != null) { connectionFactory = this.targetConnectionFactories.get(lookupKey); } if (connectionFactory == null && (this.lenientFallback || lookupKey == null)) { connectionFactory = this.defaultTargetConnectionFactory; } if (connectionFactory == null) { throw new IllegalStateException("Cannot determine target ConnectionFactory for lookup key [" + lookupKey + "]"); } return connectionFactory; }
/** * Retrieve the current target {@link ConnectionFactory}. Determines the * {@link #determineCurrentLookupKey() current lookup key}, performs * a lookup in the {@link #targetConnectionFactories} map, * falls back to the specified * {@link #defaultTargetConnectionFactory} if necessary. * @return The connection factory. * @see #determineCurrentLookupKey() */ protected ConnectionFactory determineTargetConnectionFactory() { Object lookupKey = determineCurrentLookupKey(); ConnectionFactory connectionFactory = null; if (lookupKey != null) { connectionFactory = this.targetConnectionFactories.get(lookupKey); } if (connectionFactory == null && (this.lenientFallback || lookupKey == null)) { connectionFactory = this.defaultTargetConnectionFactory; } if (connectionFactory == null) { throw new IllegalStateException("Cannot determine target ConnectionFactory for lookup key [" + lookupKey + "]"); } return connectionFactory; }