use of org.eclipse.persistence.internal.jpa.jdbc.DataSourceImpl in project eclipselink by eclipse-ee4j.
the class EntityManagerJUnitTestSuite method internalTestPostAcquirePreReleaseEvents.
public void internalTestPostAcquirePreReleaseEvents(boolean useExternalConnectionPool) {
if (isOnServer()) {
// Uses DefaultConnector.
return;
}
SessionBroker broker = ((JpaEntityManagerFactory) getEntityManagerFactory()).getSessionBroker();
// Testing ExclusiveConnectionMode.Isolated requires a session that has isolated descriptors.
ServerSession ss = (ServerSession) broker.getSessionForClass(Address.class);
if (ss.getPlatform().isSybase()) {
warning("Warning Sybase Driver does not work with DriverWrapper, testPostAcquirePreReleaseEvents can't run on this platform.");
return;
}
if (ss.getPlatform().isSymfoware()) {
warning("Test testPostAcquirePreReleaseEvents skipped for this platform, " + "Symfoware platform doesn't support failover.");
return;
}
// normally false; set to true for debug output for just this single test
boolean shouldForceFinest = false;
int originalLogLevel = -1;
// cache the original driver name and connection string.
String originalDriverName = ss.getLogin().getDriverClassName();
String originalConnectionString = ss.getLogin().getConnectionString();
// cache original connector for external connection pool case
Connector originalConnector = ss.getLogin().getConnector();
// the new driver name and connection string to be used by the test
String newDriverName = DriverWrapper.class.getName();
String newConnectionString = DriverWrapper.codeUrl(originalConnectionString);
// setup the wrapper driver
DriverWrapper.initialize(originalDriverName);
// The test need to connect with the new driver and connection string.
// That could be done in JPA:
// // close the existing emf
// closeEntityManagerFactory();
// HashMap properties = new HashMap(JUnitTestCaseHelper.getDatabaseProperties());
// properties.put(PersistenceUnitProperties.JDBC_DRIVER, newDriverName);
// properties.put(PersistenceUnitProperties.JDBC_URL, newConnectionString);
// emf = getEntityManagerFactory(properties);
// However this only works in case closeEntityManagerFactory disconnects the original ServerSession,
// which requires the factory to be the only one using the persistence unit.
// Alternative - and faster - approach is to disconnect the original session directly
// and then reconnected it with the new driver and connection string.
broker.logout();
if (useExternalConnectionPool) {
ss.getLogin().setConnector(new JNDIConnector(new DataSourceImpl(null, newConnectionString, null, null)));
ss.getLogin().useExternalConnectionPooling();
} else {
ss.getLogin().setDriverClassName(newDriverName);
ss.getLogin().setConnectionString(newConnectionString);
}
if (shouldForceFinest) {
if (broker.getLogLevel() != SessionLog.FINEST) {
originalLogLevel = broker.getLogLevel();
broker.setLogLevel(SessionLog.FINEST);
}
}
// switch off reconnection
boolean originalIsConnectionHealthValidatedOnError = ss.getLogin().isConnectionHealthValidatedOnError();
ss.getLogin().setConnectionHealthValidatedOnError(false);
// Using DriverWrapper the listener will repair connection on postAcquireConnection and break it on preReleaseConnection event.
// Also the listener will verify that neither postAcquireConnection nor preReleaseConnection events not called two in a row.
AcquireRepair_ReleaseBreak_Listener listener = new AcquireRepair_ReleaseBreak_Listener();
ss.getEventManager().addListener(listener);
// Driver's connect method will still work, however any method called on any acquired connection will throw SQLException.
// On postAcquireConnection connection will be repaired; on preReleaseConnection - broken again.
broker.log(SessionLog.FINEST, SessionLog.CONNECTION, "testPostAcquirePreReleaseEvents: DriverWrapper.breakOldConnections(); DriverWrapper.breakNewConnections();", null, null, false);
DriverWrapper.breakOldConnections();
DriverWrapper.breakNewConnections();
broker.login();
// test several configurations:
// all exclusive connection modes
String[] exclusiveConnectionModeArray = new String[] { ExclusiveConnectionMode.Transactional, ExclusiveConnectionMode.Isolated, ExclusiveConnectionMode.Always };
// Normally the user wishing to use not pooled connection would specify user and password properties (and possibly db url, too).
// However if these properties have the same values that those in the logging then no non pooled connection is created and the pooled one used instead.
// In the test we must use the same user as already in the session login (don't know any others) that forces usage of ConnectionPolicy property.
ConnectionPolicy connectionPolicy = (ConnectionPolicy) ss.getDefaultConnectionPolicy().clone();
connectionPolicy.setLogin(ss.getLogin());
connectionPolicy.setPoolName(null);
try {
HashMap emProperties = new HashMap(1);
HashMap mapOfProperties = new HashMap(1);
emProperties.put(PersistenceUnitProperties.COMPOSITE_UNIT_PROPERTIES, mapOfProperties);
HashMap memberProperties = new HashMap();
mapOfProperties.put(ss.getName(), memberProperties);
String mode, pooled = "", exclusiveConnectionMode;
for (int k = 0; k < 2; k++) {
if (k == 1) {
// use non pooled connections
pooled = "non pooled; ";
memberProperties.put(EntityManagerProperties.CONNECTION_POLICY, connectionPolicy);
}
for (int i = 0; i < exclusiveConnectionModeArray.length; i++) {
exclusiveConnectionMode = exclusiveConnectionModeArray[i];
for (int j = 0; j < 3; j++) {
// either beginning early transaction or not
boolean shouldBeginEarlyTransaction = (j == 2);
boolean shouldReadBeforeTransaction = (j == 1);
mode = pooled + exclusiveConnectionMode + (shouldBeginEarlyTransaction ? "; beginEarlyTransaction" : "") + (shouldReadBeforeTransaction ? "; readBeforeTransaction" : "");
broker.log(SessionLog.FINEST, SessionLog.CONNECTION, "testPostAcquirePreReleaseEvents: " + mode, null, null, false);
memberProperties.put(EntityManagerProperties.EXCLUSIVE_CONNECTION_MODE, exclusiveConnectionMode);
EntityManager em = createEntityManager(emProperties);
if (shouldReadBeforeTransaction) {
em.find(Address.class, 1);
}
Address address = null;
try {
em.getTransaction().begin();
if (shouldBeginEarlyTransaction) {
em.unwrap(UnitOfWorkImpl.class).beginEarlyTransaction();
}
address = new Address();
address.setCountry("testPostAcquirePreReleaseEvents");
em.persist(address);
em.getTransaction().commit();
} finally {
// expected exception - connection is invalid and cannot be reconnected.
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
closeEntityManager(em);
}
if (listener.hasAcquiredConnections()) {
fail(mode + " connection was not passed to preReleaseConnection event");
}
}
}
}
} finally {
// clear the driver wrapper
DriverWrapper.clear();
// reconnect the session using the original driver and connection string
ss.getEventManager().removeListener(listener);
// clean-up
// remove the inserted object
EntityManager em = createEntityManager();
em.getTransaction().begin();
try {
em.createQuery("DELETE FROM Address a WHERE a.country = 'testPostAcquirePreReleaseEvents'");
em.getTransaction().commit();
} finally {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
closeEntityManager(em);
broker.logout();
if (originalLogLevel >= 0) {
broker.setLogLevel(originalLogLevel);
}
if (useExternalConnectionPool) {
ss.getLogin().setConnector(originalConnector);
ss.getLogin().dontUseExternalConnectionPooling();
} else {
ss.getLogin().setDriverClassName(originalDriverName);
ss.getLogin().setConnectionString(originalConnectionString);
}
ss.getLogin().setConnectionHealthValidatedOnError(originalIsConnectionHealthValidatedOnError);
broker.login();
}
}
}
use of org.eclipse.persistence.internal.jpa.jdbc.DataSourceImpl in project eclipselink by eclipse-ee4j.
the class EntityManagerJUnitTestSuite method internalTestPostAcquirePreReleaseEvents.
public void internalTestPostAcquirePreReleaseEvents(boolean useExternalConnectionPool) {
if (isOnServer()) {
// Uses DefaultConnector.
return;
}
ServerSession ss = ((JpaEntityManagerFactory) getEntityManagerFactory()).getServerSession();
// Assert.assertFalse("Warning Sybase Driver does not work with DriverWrapper, testPostAcquirePreReleaseEvents can't run on this platform.", ss.getPlatform().isSybase());
if (ss.getPlatform().isSymfoware()) {
getServerSession().logMessage("Test testPostAcquirePreReleaseEvents skipped for this platform, " + "Symfoware platform doesn't support failover.");
return;
}
// normally false; set to true for debug output for just this single test
boolean shouldForceFinest = false;
int originalLogLevel = -1;
// cache the original driver name and connection string.
String originalDriverName = ss.getLogin().getDriverClassName();
String originalConnectionString = ss.getLogin().getConnectionString();
// cache original connector for external connection pool case
Connector originalConnector = ss.getLogin().getConnector();
// the new driver name and connection string to be used by the test
String newDriverName = DriverWrapper.class.getName();
String newConnectionString = DriverWrapper.codeUrl(originalConnectionString);
// setup the wrapper driver
DriverWrapper.initialize(originalDriverName);
// The test need to connect with the new driver and connection string.
// That could be done in JPA:
// // close the existing emf
// closeEntityManagerFactory();
// HashMap properties = new HashMap(JUnitTestCaseHelper.getDatabaseProperties());
// properties.put(PersistenceUnitProperties.JDBC_DRIVER, newDriverName);
// properties.put(PersistenceUnitProperties.JDBC_URL, newConnectionString);
// emf = getEntityManagerFactory(properties);
// However this only works in case closeEntityManagerFactory disconnects the original ServerSession,
// which requires the factory to be the only one using the persistence unit.
// Alternative - and faster - approach is to disconnect the original session directly
// and then reconnected it with the new driver and connection string.
ss.logout();
if (useExternalConnectionPool) {
ss.getLogin().setConnector(new JNDIConnector(new DataSourceImpl(null, newConnectionString, null, null)));
ss.getLogin().useExternalConnectionPooling();
} else {
ss.getLogin().setDriverClassName(newDriverName);
ss.getLogin().setConnectionString(newConnectionString);
}
if (shouldForceFinest) {
if (ss.getLogLevel() != SessionLog.FINEST) {
originalLogLevel = ss.getLogLevel();
ss.setLogLevel(SessionLog.FINEST);
}
}
// switch off reconnection
boolean originalIsConnectionHealthValidatedOnError = ss.getLogin().isConnectionHealthValidatedOnError();
ss.getLogin().setConnectionHealthValidatedOnError(false);
// Using DriverWrapper the listener will repair connection on postAcquireConnection and break it on preReleaseConnection event.
// Also the listener will verify that neither postAcquireConnection nor preReleaseConnection events not called two in a row.
AcquireRepair_ReleaseBreak_Listener listener = new AcquireRepair_ReleaseBreak_Listener();
ss.getEventManager().addListener(listener);
// Driver's connect method will still work, however any method called on any acquired connection will throw SQLException.
// On postAcquireConnection connection will be repaired; on preReleaseConnection - broken again.
ss.log(SessionLog.FINEST, SessionLog.CONNECTION, "testPostAcquirePreReleaseEvents: DriverWrapper.breakOldConnections(); DriverWrapper.breakNewConnections();", null, null, false);
DriverWrapper.breakOldConnections();
DriverWrapper.breakNewConnections();
ss.login();
// test several configurations:
// all exclusive connection modes
String[] exclusiveConnectionModeArray = new String[] { ExclusiveConnectionMode.Transactional, ExclusiveConnectionMode.Isolated, ExclusiveConnectionMode.Always };
// Normally the user wishing to use not pooled connection would specify user and password properties (and possibly db url, too).
// However if these properties have the same values that those in the logging then no non pooled connection is created and the pooled one used instead.
// In the test we must use the same user as already in the session login (don't know any others) that forces usage of ConnectionPolicy property.
ConnectionPolicy connectionPolicy = (ConnectionPolicy) ss.getDefaultConnectionPolicy().clone();
connectionPolicy.setLogin(ss.getLogin());
connectionPolicy.setPoolName(null);
try {
HashMap emProperties = new HashMap();
String mode, pooled = "", exclusiveConnectionMode;
for (int k = 0; k < 2; k++) {
if (k == 1) {
// use non pooled connections
pooled = "non pooled; ";
emProperties.put(EntityManagerProperties.CONNECTION_POLICY, connectionPolicy);
}
for (int i = 0; i < exclusiveConnectionModeArray.length; i++) {
exclusiveConnectionMode = exclusiveConnectionModeArray[i];
for (int j = 0; j < 3; j++) {
// either beginning early transaction or not
boolean shouldBeginEarlyTransaction = (j == 2);
boolean shouldReadBeforeTransaction = (j == 1);
mode = pooled + exclusiveConnectionMode + (shouldBeginEarlyTransaction ? "; beginEarlyTransaction" : "") + (shouldReadBeforeTransaction ? "; readBeforeTransaction" : "");
ss.log(SessionLog.FINEST, SessionLog.CONNECTION, "testPostAcquirePreReleaseEvents: " + mode, null, null, false);
emProperties.put(EntityManagerProperties.EXCLUSIVE_CONNECTION_MODE, exclusiveConnectionMode);
EntityManager em = createEntityManager(emProperties);
if (shouldReadBeforeTransaction) {
em.find(Employee.class, 1);
}
Employee emp = null;
try {
em.getTransaction().begin();
if (shouldBeginEarlyTransaction) {
em.unwrap(UnitOfWorkImpl.class).beginEarlyTransaction();
}
emp = new Employee();
emp.setFirstName("testPostAcquirePreReleaseEvents");
em.persist(emp);
em.getTransaction().commit();
} finally {
// expected exception - connection is invalid and cannot be reconnected.
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
closeEntityManager(em);
}
if (listener.hasAcquiredConnections()) {
fail(mode + " connection was not passed to preReleaseConnection event");
}
}
}
}
} finally {
// clear the driver wrapper
DriverWrapper.clear();
// reconnect the session using the original driver and connection string
ss.getEventManager().removeListener(listener);
// clean-up
// remove the inserted object
EntityManager em = createEntityManager();
em.getTransaction().begin();
try {
em.createQuery("DELETE FROM Employee e WHERE e.firstName = 'testPostAcquirePreReleaseEvents'");
em.getTransaction().commit();
} finally {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
closeEntityManager(em);
ss.logout();
if (originalLogLevel >= 0) {
ss.setLogLevel(originalLogLevel);
}
if (useExternalConnectionPool) {
ss.getLogin().setConnector(originalConnector);
ss.getLogin().dontUseExternalConnectionPooling();
} else {
ss.getLogin().setDriverClassName(originalDriverName);
ss.getLogin().setConnectionString(originalConnectionString);
}
ss.getLogin().setConnectionHealthValidatedOnError(originalIsConnectionHealthValidatedOnError);
ss.login();
}
}
}
use of org.eclipse.persistence.internal.jpa.jdbc.DataSourceImpl in project eclipselink by eclipse-ee4j.
the class PersistenceContentHandler method endElement.
@Override
public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
String string = stringBuffer.toString().trim();
stringBuffer.delete(0, stringBuffer.length());
readCharacters = false;
if (NS_URI.equals(namespaceURI) || NAMESPACE_URI.equals(namespaceURI) || NAMESPACE_URI_OLD.equals(namespaceURI)) {
if (ELEMENT_PROVIDER.equals(localName)) {
persistenceUnitInfo.setPersistenceProviderClassName(string);
return;
} else if (ELEMENT_JTA_DATA_SOURCE.equals(localName)) {
persistenceUnitInfo.setJtaDataSource(// throw an exception on access
new DataSourceImpl(string, null, null, null));
return;
} else if (ELEMENT_NON_JTA_DATA_SOURCE.equals(localName)) {
persistenceUnitInfo.setNonJtaDataSource(// throw an exception on access
new DataSourceImpl(string, null, null, null));
return;
} else if (ELEMENT_MAPPING_FILE.equals(localName)) {
persistenceUnitInfo.getMappingFileNames().add(string);
return;
} else if (ELEMENT_JAR_FILE.equals(localName)) {
persistenceUnitInfo.getJarFiles().add(string);
return;
} else if (ELEMENT_CLASS.equals(localName)) {
persistenceUnitInfo.getManagedClassNames().add(string);
return;
} else if (ELEMENT_EXCLUDE_UNLISTED_CLASSES.equals(localName)) {
if (string.equals("true") || string.equals("1") || string.equals("")) {
// default <exclude-unlisted-classes/> to true as well (an empty string)
persistenceUnitInfo.setExcludeUnlistedClasses(true);
} else {
persistenceUnitInfo.setExcludeUnlistedClasses(false);
}
return;
} else if (ELEMENT_CACHING.equals(localName)) {
persistenceUnitInfo.setSharedCacheMode(string);
} else if (ELEMENT_VALIDATION_MODE.equals(localName)) {
persistenceUnitInfo.setValidationMode(string);
} else if (ELEMENT_PERSISTENCE_UNIT.equals(localName)) {
if (persistenceUnitInfo != null) {
persistenceUnits.add(persistenceUnitInfo);
persistenceUnitInfo = null;
}
}
}
}
use of org.eclipse.persistence.internal.jpa.jdbc.DataSourceImpl in project eclipselink by eclipse-ee4j.
the class EntityManagerSetupImpl method updateLogins.
/**
* Override the default login creation method.
* If persistenceInfo is available, use the information from it to setup the login
* and possibly to set readConnectionPool.
*/
protected void updateLogins(Map m) {
DatasourceLogin login = (DatasourceLogin) this.session.getDatasourceLogin();
String eclipselinkPlatform = PropertiesHandler.getPropertyValueLogDebug(PersistenceUnitProperties.TARGET_DATABASE, m, this.session);
if (eclipselinkPlatform != null) {
login.setPlatformClassName(eclipselinkPlatform, this.persistenceUnitInfo.getClassLoader());
}
// Check for EIS platform, need to use an EIS login.
boolean isEIS = false;
if (login.getDatasourcePlatform() instanceof EISPlatform) {
isEIS = true;
EISLogin newLogin = new EISLogin();
newLogin.setDatasourcePlatform(login.getDatasourcePlatform());
this.session.setDatasourceLogin(newLogin);
if (this.session.isServerSession()) {
for (ConnectionPool pool : ((ServerSession) this.session).getConnectionPools().values()) {
pool.setLogin(newLogin);
}
}
login = newLogin;
}
// Check for EIS or custom (JDBC) Connector class.
Object connectorValue = getConfigPropertyLogDebug(PersistenceUnitProperties.NOSQL_CONNECTION_SPEC, m, this.session);
String connectorProperty = PersistenceUnitProperties.NOSQL_CONNECTION_SPEC;
if (connectorValue == null) {
connectorValue = getConfigPropertyLogDebug(PersistenceUnitProperties.JDBC_CONNECTOR, m, this.session);
connectorProperty = PersistenceUnitProperties.JDBC_CONNECTOR;
}
if (connectorValue instanceof Connector) {
login.setConnector((Connector) connectorValue);
} else if (connectorValue instanceof String) {
Connector connector = null;
try {
Class<? extends Connector> cls = null;
// Try both class loaders.
try {
cls = findClassForProperty((String) connectorValue, connectorProperty, this.persistenceUnitInfo.getClassLoader());
} catch (Throwable failed) {
cls = findClassForProperty((String) connectorValue, connectorProperty, getClass().getClassLoader());
}
Constructor<? extends Connector> constructor = cls.getConstructor();
connector = constructor.newInstance();
} catch (Exception exception) {
throw EntityManagerSetupException.failedToInstantiateProperty((String) connectorValue, connectorProperty, exception);
}
if (connector != null) {
login.setConnector(connector);
}
} else if (connectorValue != null) {
// Assume JCA connection spec.
((EISConnectionSpec) login.getConnector()).setConnectionSpecObject(connectorValue);
}
// Check for EIS ConnectionFactory.
Object factoryValue = getConfigPropertyLogDebug(PersistenceUnitProperties.NOSQL_CONNECTION_FACTORY, m, this.session);
if (factoryValue instanceof String) {
// JNDI name.
((EISConnectionSpec) login.getConnector()).setName((String) factoryValue);
} else if (factoryValue != null) {
((EISConnectionSpec) login.getConnector()).setConnectionFactoryObject(factoryValue);
}
// Process EIS or JDBC connection properties.
Map propertiesMap = PropertiesHandler.getPrefixValuesLogDebug(PersistenceUnitProperties.NOSQL_PROPERTY, m, session);
if (propertiesMap.isEmpty()) {
propertiesMap = PropertiesHandler.getPrefixValuesLogDebug(PersistenceUnitProperties.JDBC_PROPERTY, m, session);
}
for (Iterator iterator = propertiesMap.entrySet().iterator(); iterator.hasNext(); ) {
Map.Entry entry = (Map.Entry) iterator.next();
String property = (String) entry.getKey();
Object value = entry.getValue();
login.setProperty(property, value);
}
// Note: This call does not checked the stored persistenceUnitInfo or extended properties because
// the map passed into this method should represent the full set of properties we expect to process
String user = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_USER, m, this.session);
String password = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_PASSWORD, m, this.session);
if (user != null) {
login.setUserName(user);
}
if (password != null) {
login.setPassword(this.securableObjectHolder.getSecurableObject().decryptPassword(password));
}
PersistenceUnitTransactionType transactionType = this.persistenceUnitInfo.getTransactionType();
// bug 5867753: find and override the transaction type using properties
String transTypeString = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.TRANSACTION_TYPE, m, this.session);
if (transTypeString != null && transTypeString.length() > 0) {
transactionType = PersistenceUnitTransactionType.valueOf(transTypeString);
}
// find the jta datasource
javax.sql.DataSource jtaDatasource = getDatasourceFromProperties(m, PersistenceUnitProperties.JTA_DATASOURCE, this.persistenceUnitInfo.getJtaDataSource());
// find the non jta datasource
javax.sql.DataSource nonjtaDatasource = getDatasourceFromProperties(m, PersistenceUnitProperties.NON_JTA_DATASOURCE, this.persistenceUnitInfo.getNonJtaDataSource());
if (isValidationOnly(m, false) && transactionType == PersistenceUnitTransactionType.JTA && jtaDatasource == null) {
updateLoginDefaultConnector(login, m);
return;
}
login.setUsesExternalTransactionController(transactionType == PersistenceUnitTransactionType.JTA);
// Avoid processing data-source if EIS, as container may pass in a default one.
if (isEIS) {
return;
}
javax.sql.DataSource mainDatasource = null;
javax.sql.DataSource readDatasource = null;
if (login.shouldUseExternalTransactionController()) {
// JtaDataSource is guaranteed to be non null - otherwise exception would've been thrown earlier
mainDatasource = jtaDatasource;
// only define readDatasource if there is jta mainDatasource
readDatasource = nonjtaDatasource;
} else {
// JtaDataSource will be ignored because transactionType is RESOURCE_LOCAL
if (jtaDatasource != null) {
session.log(SessionLog.WARNING, SessionLog.TRANSACTION, "resource_local_persistence_init_info_ignores_jta_data_source", this.persistenceUnitInfo.getPersistenceUnitName());
}
if (nonjtaDatasource != null) {
mainDatasource = nonjtaDatasource;
} else {
updateLoginDefaultConnector(login, m);
return;
}
}
// mainDatasource is guaranteed to be non null - TODO: No it is not, if they did not set one it is null, should raise error, not null-pointer.
if (!(login.getConnector() instanceof JNDIConnector)) {
JNDIConnector jndiConnector;
if (mainDatasource instanceof DataSourceImpl) {
// Bug5209363 Pass in the datasource name instead of the dummy datasource
jndiConnector = new JNDIConnector(((DataSourceImpl) mainDatasource).getName());
} else {
jndiConnector = new JNDIConnector(mainDatasource);
}
login.setConnector(jndiConnector);
String useInternalConnectionPool = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.CONNECTION_POOL_INTERNALLY_POOL_DATASOURCE, m, this.session);
if (!"true".equalsIgnoreCase(useInternalConnectionPool)) {
login.setUsesExternalConnectionPooling(true);
}
}
if (this.session.isServerSession()) {
// set readLogin
if (readDatasource != null) {
DatasourceLogin readLogin = login.clone();
readLogin.dontUseExternalTransactionController();
JNDIConnector jndiConnector;
if (readDatasource instanceof DataSourceImpl) {
// Bug5209363 Pass in the datasource name instead of the dummy datasource
jndiConnector = new JNDIConnector(((DataSourceImpl) readDatasource).getName());
} else {
jndiConnector = new JNDIConnector(readDatasource);
}
readLogin.setConnector(jndiConnector);
((ServerSession) this.session).setReadConnectionPool(readLogin);
}
}
}
Aggregations