mirror of https://github.com/apache/activemq.git
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:
parent
53082e6a14
commit
d4a50a7340
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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,17 +151,19 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
|
||||||
public void start() throws Exception {
|
public void start() throws Exception {
|
||||||
getAdapter().setUseExternalMessageReferences(isUseExternalMessageReferences());
|
getAdapter().setUseExternalMessageReferences(isUseExternalMessageReferences());
|
||||||
|
|
||||||
TransactionContext transactionContext = getTransactionContext();
|
if (isCreateTablesOnStartup()) {
|
||||||
transactionContext.begin();
|
TransactionContext transactionContext = getTransactionContext();
|
||||||
try {
|
transactionContext.begin();
|
||||||
try {
|
try {
|
||||||
getAdapter().doCreateTables(transactionContext);
|
try {
|
||||||
} catch (SQLException e) {
|
getAdapter().doCreateTables(transactionContext);
|
||||||
log.warn("Cannot create tables due to: " + e);
|
} catch (SQLException e) {
|
||||||
JDBCPersistenceAdapter.log("Failure Details: ",e);
|
log.warn("Cannot create tables due to: " + e);
|
||||||
|
JDBCPersistenceAdapter.log("Failure Details: ",e);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
transactionContext.commit();
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
transactionContext.commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUseDatabaseLock()) {
|
if (isUseDatabaseLock()) {
|
||||||
|
@ -395,7 +398,14 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue