git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@669733 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-06-19 22:45:13 +00:00
parent 99372e1189
commit f7303237ad
1 changed files with 20 additions and 1 deletions

View File

@ -80,6 +80,7 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
private long lockKeepAlivePeriod = 1000*30;
private DatabaseLocker databaseLocker;
private boolean createTablesOnStartup = true;
private DataSource lockDataSource;
public JDBCPersistenceAdapter() {
}
@ -267,6 +268,24 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
}
return databaseLocker;
}
public DataSource getLockDataSource() throws IOException {
if (lockDataSource == null) {
lockDataSource = getDataSource();
if (lockDataSource == null) {
throw new IllegalArgumentException(
"No dataSource property has been configured");
}
} else {
LOG.info("Using a separate dataSource for locking: "
+ lockDataSource);
}
return lockDataSource;
}
public void setLockDataSource(DataSource dataSource) {
this.lockDataSource = dataSource;
}
/**
* Sets the database locker strategy to use to lock the database on startup
@ -481,7 +500,7 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
}
protected DatabaseLocker createDatabaseLocker() throws IOException {
return new DefaultDatabaseLocker(getDataSource(), getStatements());
return new DefaultDatabaseLocker(getLockDataSource(), getStatements());
}
public void setBrokerName(String brokerName) {