activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r434344 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store: DefaultPersistenceAdapterFactory.java jdbc/JDBCPersistenceAdapter.java
Date Thu, 24 Aug 2006 09:00:57 GMT
Author: jstrachan
Date: Thu Aug 24 02:00:55 2006
New Revision: 434344

URL: http://svn.apache.org/viewvc?rev=434344&view=rev
Log:
allow users to disable the creation of the DDL tables on startup

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/DefaultPersistenceAdapterFactory.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/DefaultPersistenceAdapterFactory.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/DefaultPersistenceAdapterFactory.java?rev=434344&r1=434343&r2=434344&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/DefaultPersistenceAdapterFactory.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/DefaultPersistenceAdapterFactory.java
Thu Aug 24 02:00:55 2006
@@ -167,6 +167,14 @@
         jdbcPersistenceAdapter.setUseDatabaseLock(useDatabaseLock);
     }
 
+    public boolean isCreateTablesOnStartup() {
+        return jdbcPersistenceAdapter.isCreateTablesOnStartup();
+    }
+
+    public void setCreateTablesOnStartup(boolean createTablesOnStartup) {
+        jdbcPersistenceAdapter.setCreateTablesOnStartup(createTablesOnStartup);
+    }
+
     /**
      * @throws IOException
      */

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java?rev=434344&r1=434343&r2=434344&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
Thu Aug 24 02:00:55 2006
@@ -77,6 +77,7 @@
     private boolean useDatabaseLock = true;
     private int lockKeepAlivePeriod = 0;
     private DatabaseLocker databaseLocker;
+    private boolean createTablesOnStartup = true;
 
     public JDBCPersistenceAdapter() {
     }
@@ -150,17 +151,19 @@
     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 @@
         this.useExternalMessageReferences = useExternalMessageReferences;
     }
     
-    
+    public boolean isCreateTablesOnStartup() {
+        return createTablesOnStartup;
+    }
+
+    public void setCreateTablesOnStartup(boolean createTablesOnStartup) {
+        this.createTablesOnStartup = createTablesOnStartup;
+    }
+
     public boolean isUseDatabaseLock() {
         return useDatabaseLock;
     }



Mime
View raw message