mirror of https://github.com/apache/activemq.git
fix for https://issues.apache.org/activemq/browse/AMQ-1886 - jdbc adapter without journal + test case
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@801612 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e183a824d3
commit
52f48db0d9
|
@ -162,10 +162,13 @@ public class TransactionContext {
|
|||
}
|
||||
} catch (SQLException e) {
|
||||
JDBCPersistenceAdapter.log("Commit failed: ", e);
|
||||
|
||||
this.rollback();
|
||||
|
||||
throw IOExceptionSupport.create(e);
|
||||
} finally {
|
||||
inTx = false;
|
||||
close();
|
||||
inTx = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,8 +195,8 @@ public class TransactionContext {
|
|||
JDBCPersistenceAdapter.log("Rollback failed: ", e);
|
||||
throw IOExceptionSupport.create(e);
|
||||
} finally {
|
||||
inTx = false;
|
||||
close();
|
||||
inTx = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,6 @@ import org.apache.activemq.store.jdbc.Statements;
|
|||
* @org.apache.xbean.XBean element="db2JDBCAdapter"
|
||||
*/
|
||||
public class DB2JDBCAdapter extends DefaultJDBCAdapter {
|
||||
public DB2JDBCAdapter() {
|
||||
batchStatments = false;
|
||||
}
|
||||
|
||||
public void setStatements(Statements statements) {
|
||||
String lockCreateStatement = "LOCK TABLE " + statements.getFullLockTableName() + " IN EXCLUSIVE MODE";
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package org.apache.activemq.store.jdbc;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.broker.BrokerTest;
|
||||
import org.apache.derby.jdbc.EmbeddedDataSource;
|
||||
|
||||
public class JDBCStoreBrokerTest extends BrokerTest {
|
||||
|
||||
protected BrokerService createBroker() throws Exception {
|
||||
BrokerService broker = new BrokerService();
|
||||
JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
|
||||
EmbeddedDataSource dataSource = new EmbeddedDataSource();
|
||||
dataSource.setDatabaseName("derbyDb");
|
||||
dataSource.setCreateDatabase("create");
|
||||
jdbc.setDataSource(dataSource);
|
||||
|
||||
jdbc.deleteAllMessages();
|
||||
broker.setPersistenceAdapter(jdbc);
|
||||
return broker;
|
||||
}
|
||||
|
||||
protected BrokerService createRestartedBroker() throws Exception {
|
||||
BrokerService broker = new BrokerService();
|
||||
JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
|
||||
EmbeddedDataSource dataSource = new EmbeddedDataSource();
|
||||
dataSource.setDatabaseName("derbyDb");
|
||||
dataSource.setCreateDatabase("create");
|
||||
jdbc.setDataSource(dataSource);
|
||||
broker.setPersistenceAdapter(jdbc);
|
||||
return broker;
|
||||
}
|
||||
|
||||
|
||||
public static Test suite() {
|
||||
return suite(JDBCStoreBrokerTest.class);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(suite());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue