Author: clebert.suconic(a)jboss.com
Date: 2009-11-23 15:32:47 -0500 (Mon, 23 Nov 2009)
New Revision: 8383
Modified:
branches/ClebertCallback/src/main/org/hornetq/core/journal/impl/JournalImpl.java
branches/ClebertCallback/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java
Log:
one phase fix
Modified:
branches/ClebertCallback/src/main/org/hornetq/core/journal/impl/JournalImpl.java
===================================================================
---
branches/ClebertCallback/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2009-11-23
20:03:33 UTC (rev 8382)
+++
branches/ClebertCallback/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2009-11-23
20:32:47 UTC (rev 8383)
@@ -1366,14 +1366,12 @@
try
{
+
if (tx == null)
{
- log.warn("Commit being called on an empty transaction, ignoring call. ID
= " + txID);
- // Commit being called on an empty transaction
- callback.done();
- return;
+ throw new IllegalStateException("Cannot find tx with id " + txID);
}
-
+
ChannelBuffer bb = newBuffer(SIZE_COMPLETE_TRANSACTION_RECORD);
writeTransaction(-1,
Modified:
branches/ClebertCallback/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java
===================================================================
---
branches/ClebertCallback/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java 2009-11-23
20:03:33 UTC (rev 8382)
+++
branches/ClebertCallback/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java 2009-11-23
20:32:47 UTC (rev 8383)
@@ -203,18 +203,8 @@
}
}
- if (xid != null)
+ if (xid != null && !onePhase)
{
- if (onePhase)
- {
- if (state == State.ACTIVE)
- {
- // Why do we need a prepare record on the onePhase optimization?
- // Why we can't just go straight to commit, if we are doing one
phase anyway?
- state = State.PREPARED;
-// prepare();
- }
- }
if (state != State.PREPARED)
{
throw new IllegalStateException("Transaction is in invalid state
" + state);
@@ -246,6 +236,8 @@
// We use the Callback even for non persistence
// If we are using non-persistence with replication, the replication manager
will have
// to execute this runnable in the correct order
+ // This also will only use a different thread if there are any IO pendings.
+ // If the IO finished early by the time we got here, we won't need an
executor
storageManager.afterCompleteOperations(new IOAsyncTask()
{