activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r480072 - in /incubator/activemq/trunk/activemq-core/src/main: java/org/apache/activemq/store/jdbc/ java/org/apache/activemq/store/jdbc/adapter/ resources/META-INF/services/org/apache/activemq/store/jdbc/
Date Tue, 28 Nov 2006 14:47:07 GMT
Author: jstrachan
Date: Tue Nov 28 06:47:05 2006
New Revision: 480072

URL: http://svn.apache.org/viewvc?view=rev&rev=480072
Log:
Added support for JDBC Master Slave for MySQL for AMQ-1074 thanks to the kind patch from Steve
Lotito

Added:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java
  (with props)
Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
    incubator/activemq/trunk/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/mysql-ab_jdbc_driver

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java?view=diff&rev=480072&r1=480071&r2=480072
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
Tue Nov 28 06:47:05 2006
@@ -52,14 +52,13 @@
         connection = dataSource.getConnection();
         connection.setAutoCommit(false);
         
-        PreparedStatement statement = connection.prepareStatement(statements.getLockCreateStatement());
+        log.info("Attempting to acquire the exclusive lock to become the Master broker");
+		String sql = statements.getLockCreateStatement();
+		PreparedStatement statement = connection.prepareStatement(sql);
         while (true) {
             try {
-                log.info("Attempting to acquire the exclusive lock to become the Master broker");
-                boolean answer = statement.execute();
-                if (answer) {
-                    break;
-                }
+                statement.execute();
+				break;
             }
             catch (Exception e) {
                 if (stopping) { 

Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java?view=auto&rev=480072
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java
(added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java
Tue Nov 28 06:47:05 2006
@@ -0,0 +1,32 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.store.jdbc.adapter;
+
+import org.apache.activemq.store.jdbc.Statements;
+
+/**
+ * 
+ * @version $Revision$
+ */
+public class MySqlJDBCAdapter extends DefaultJDBCAdapter {
+
+    public void setStatements(Statements statements) {
+        statements.setLockCreateStatement("LOCK TABLE " + statements.getFullLockTableName()
+ " WRITE");
+        super.setStatements(statements);
+    }    
+}

Propchange: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/activemq/trunk/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/mysql-ab_jdbc_driver
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/mysql-ab_jdbc_driver?view=diff&rev=480072&r1=480071&r2=480072
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/mysql-ab_jdbc_driver
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/mysql-ab_jdbc_driver
Tue Nov 28 06:47:05 2006
@@ -1 +1 @@
-class=org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter
\ No newline at end of file
+class=org.apache.activemq.store.jdbc.adapter.MySqlJDBCAdapter
\ No newline at end of file



Mime
View raw message