allow users to disable the creation of the DDL tables on startup

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@434344 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-08-24 09:00:55 +00:00
parent 53082e6a14
commit d4a50a7340
2 changed files with 28 additions and 10 deletions

View File

@ -167,6 +167,14 @@ public class DefaultPersistenceAdapterFactory extends DataSourceSupport implemen
jdbcPersistenceAdapter.setUseDatabaseLock(useDatabaseLock); jdbcPersistenceAdapter.setUseDatabaseLock(useDatabaseLock);
} }
public boolean isCreateTablesOnStartup() {
return jdbcPersistenceAdapter.isCreateTablesOnStartup();
}
public void setCreateTablesOnStartup(boolean createTablesOnStartup) {
jdbcPersistenceAdapter.setCreateTablesOnStartup(createTablesOnStartup);
}
/** /**
* @throws IOException * @throws IOException
*/ */

View File

@ -77,6 +77,7 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
private boolean useDatabaseLock = true; private boolean useDatabaseLock = true;
private int lockKeepAlivePeriod = 0; private int lockKeepAlivePeriod = 0;
private DatabaseLocker databaseLocker; private DatabaseLocker databaseLocker;
private boolean createTablesOnStartup = true;
public JDBCPersistenceAdapter() { public JDBCPersistenceAdapter() {
} }
@ -150,6 +151,7 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
public void start() throws Exception { public void start() throws Exception {
getAdapter().setUseExternalMessageReferences(isUseExternalMessageReferences()); getAdapter().setUseExternalMessageReferences(isUseExternalMessageReferences());
if (isCreateTablesOnStartup()) {
TransactionContext transactionContext = getTransactionContext(); TransactionContext transactionContext = getTransactionContext();
transactionContext.begin(); transactionContext.begin();
try { try {
@ -162,6 +164,7 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
} finally { } finally {
transactionContext.commit(); transactionContext.commit();
} }
}
if (isUseDatabaseLock()) { if (isUseDatabaseLock()) {
DatabaseLocker service = getDatabaseLocker(); DatabaseLocker service = getDatabaseLocker();
@ -395,6 +398,13 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
this.useExternalMessageReferences = useExternalMessageReferences; this.useExternalMessageReferences = useExternalMessageReferences;
} }
public boolean isCreateTablesOnStartup() {
return createTablesOnStartup;
}
public void setCreateTablesOnStartup(boolean createTablesOnStartup) {
this.createTablesOnStartup = createTablesOnStartup;
}
public boolean isUseDatabaseLock() { public boolean isUseDatabaseLock() {
return useDatabaseLock; return useDatabaseLock;