activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r818911 - in /activemq/branches/activemq-5.3: ./ activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java
Date Fri, 25 Sep 2009 16:27:08 GMT
Author: chirino
Date: Fri Sep 25 16:27:08 2009
New Revision: 818911

URL: http://svn.apache.org/viewvc?rev=818911&view=rev
Log:
AMQ-2414: Support mysql cluster configurations


Modified:
    activemq/branches/activemq-5.3/   (props changed)
    activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java

Propchange: activemq/branches/activemq-5.3/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep 25 16:27:08 2009
@@ -1 +1 @@
-/activemq/trunk:816278-816279,816298,818138,818140-818147,818155,818160-818176,818209,818211,818224-818262,818480,818484,818487,818496,818502,818504-818510,818513-818516,818609,818635,818724-818762,818888
+/activemq/trunk:816278-816279,816298,818138,818140-818147,818155,818160-818176,818209,818211,818224-818262,818480,818484,818487,818496,818502,818504-818510,818513-818516,818609,818635,818724-818762,818888,818905

Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java?rev=818911&r1=818910&r2=818911&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java
(original)
+++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java
Fri Sep 25 16:27:08 2009
@@ -25,18 +25,43 @@
  */
 public class MySqlJDBCAdapter extends DefaultJDBCAdapter {
 
+    // The transactional types..
+    public static final String INNODB = "INNODB";
+    public static final String NDBCLUSTER = "NDBCLUSTER";
+    public static final String BDB = "BDB";
+
+    // The non transactional types..
+    public static final String MYISAM = "MYISAM";
+    public static final String ISAM = "ISAM";
+    public static final String MERGE = "MERGE";
+    public static final String HEAP = "HEAP";
+
+    String engineType = INNODB;
+
     public void setStatements(Statements statements) {
-        statements.setLockCreateStatement("LOCK TABLE " + statements.getFullLockTableName()
+ " WRITE");
+        String type = engineType.toUpperCase();
+        if( !type.equals(INNODB) &&  !type.equals(NDBCLUSTER) ) {
+            // Don't use LOCK TABLE for the INNODB and NDBCLUSTER engine types...
+            statements.setLockCreateStatement("LOCK TABLE " + statements.getFullLockTableName()
+ " WRITE");
+        }
+
         statements.setBinaryDataType("LONGBLOB");
         
-        // Use INNODB table since we need transaction support.
+        // Update the create statements so they use the right type of engine 
         String[] s = statements.getCreateSchemaStatements();
         for (int i = 0; i < s.length; i++) {
             if( s[i].startsWith("CREATE TABLE")) {
-                s[i] = s[i]+" TYPE=INNODB";
+                s[i] = s[i]+" TYPE="+type;
             }
         }
-        
         super.setStatements(statements);
-    }    
+    }
+
+    public String getEngineType() {
+        return engineType;
+    }
+
+    public void setEngineType(String engineType) {
+        this.engineType = engineType;
+    }
 }



Mime
View raw message