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);
}
public boolean isCreateTablesOnStartup() {
return jdbcPersistenceAdapter.isCreateTablesOnStartup();
}
public void setCreateTablesOnStartup(boolean createTablesOnStartup) {
jdbcPersistenceAdapter.setCreateTablesOnStartup(createTablesOnStartup);
}
/**
* @throws IOException
*/

View File

@ -77,6 +77,7 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
private boolean useDatabaseLock = true;
private int lockKeepAlivePeriod = 0;
private DatabaseLocker databaseLocker;
private boolean createTablesOnStartup = true;
public JDBCPersistenceAdapter() {
}
@ -150,17 +151,19 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
public void start() throws Exception {
getAdapter().setUseExternalMessageReferences(isUseExternalMessageReferences());
TransactionContext transactionContext = getTransactionContext();
transactionContext.begin();
try {
if (isCreateTablesOnStartup()) {
TransactionContext transactionContext = getTransactionContext();
transactionContext.begin();
try {
getAdapter().doCreateTables(transactionContext);
} catch (SQLException e) {
log.warn("Cannot create tables due to: " + e);
JDBCPersistenceAdapter.log("Failure Details: ",e);
try {
getAdapter().doCreateTables(transactionContext);
} catch (SQLException e) {
log.warn("Cannot create tables due to: " + e);
JDBCPersistenceAdapter.log("Failure Details: ",e);
}
} finally {
transactionContext.commit();
}
} finally {
transactionContext.commit();
}
if (isUseDatabaseLock()) {
@ -395,7 +398,14 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
this.useExternalMessageReferences = useExternalMessageReferences;
}
public boolean isCreateTablesOnStartup() {
return createTablesOnStartup;
}
public void setCreateTablesOnStartup(boolean createTablesOnStartup) {
this.createTablesOnStartup = createTablesOnStartup;
}
public boolean isUseDatabaseLock() {
return useDatabaseLock;
}