Author: manik.surtani(a)jboss.com
Date: 2008-05-15 18:30:34 -0400 (Thu, 15 May 2008)
New Revision: 5857
Modified:
core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
Log:
fixed broken stuff
Modified: core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2008-05-15 17:25:53
UTC (rev 5856)
+++ core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2008-05-15 22:30:34
UTC (rev 5857)
@@ -98,7 +98,7 @@
public boolean isSynchronous()
{
- return this == REPL_SYNC || this == INVALIDATION_SYNC;
+ return this == REPL_SYNC || this == INVALIDATION_SYNC || this == LOCAL;
}
}
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java 2008-05-15
17:25:53 UTC (rev 5856)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java 2008-05-15
22:30:34 UTC (rev 5857)
@@ -1,8 +1,8 @@
package org.jboss.cache.interceptors;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.tx.CommitCommand;
+import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.notifications.NotifierImpl;
@@ -16,16 +16,23 @@
public class NotificationInterceptor extends BaseTransactionalContextInterceptor
{
private NotifierImpl notifier;
- private CacheSPI cacheSPI;
@Inject
- public void injectDependencies(NotifierImpl notifier, CacheSPI cacheSPI)
+ public void injectDependencies(NotifierImpl notifier)
{
this.notifier = notifier;
- this.cacheSPI = cacheSPI;
}
@Override
+ public Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command)
throws Throwable
+ {
+ Object retval = invokeNextInterceptor(ctx, command);
+ if (command.isOnePhaseCommit())
notifier.notifyTransactionCompleted(ctx.getTransaction(), true, ctx);
+
+ return retval;
+ }
+
+ @Override
public Object visitCommitCommand(InvocationContext ctx, CommitCommand command) throws
Throwable
{
Object retval = invokeNextInterceptor(ctx, command);
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java 2008-05-15
17:25:53 UTC (rev 5856)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java 2008-05-15
22:30:34 UTC (rev 5857)
@@ -123,7 +123,7 @@
* @throws Throwable
*/
@Override
- protected boolean replayModifications(InvocationContext ctx, Transaction ltx,
PrepareCommand command) throws Throwable
+ protected void replayModifications(InvocationContext ctx, Transaction ltx,
PrepareCommand command) throws Throwable
{
if (log.isDebugEnabled()) log.debug("Handling optimistic remote prepare "
+ ctx.getGlobalTransaction());
@@ -135,9 +135,8 @@
catch (Throwable t)
{
log.error("Prepare failed!", t);
- return false;
+ throw t;
}
- return true;
}
@Override
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-05-15
17:25:53 UTC (rev 5856)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-05-15
22:30:34 UTC (rev 5857)
@@ -373,9 +373,13 @@
// register a sync handler for this tx.
registerHandler(ltx, new RemoteSynchronizationHandler(gtx, ltx, entry), ctx);
+ success = false;
+
// replay modifications
- success = replayModifications(ctx, ltx, command);
+ replayModifications(ctx, ltx, command);
+ success = true; // no exceptions were thrown above!!
+
// now pass the prepare command up the chain as well.
if (command.isOnePhaseCommit())
{
@@ -485,7 +489,7 @@
* @return
* @throws Exception
*/
- protected boolean replayModifications(InvocationContext ctx, Transaction ltx,
PrepareCommand command) throws Throwable
+ protected void replayModifications(InvocationContext ctx, Transaction ltx,
PrepareCommand command) throws Throwable
{
try
{
@@ -495,12 +499,11 @@
invokeNextInterceptor(ctx, modification);
assertTxIsStillValid(ltx);
}
- return true;
}
catch (Throwable th)
{
log.error("prepare failed!", th);
- return false;
+ throw th;
}
}
Show replies by date