[jbosscache-commits] JBoss Cache SVN: r6896 - in core/branches/flat/src/main/java/org/jboss: cache/interceptors and 5 other directories.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Thu Oct 9 08:52:16 EDT 2008
Author: mircea.markus
Date: 2008-10-09 08:52:15 -0400 (Thu, 09 Oct 2008)
New Revision: 6896
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/batch/
core/branches/flat/src/main/java/org/jboss/starobrno/batch/BatchContainer.java
core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/BatchingInterceptor.java
Removed:
core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/BatchingInterceptor.java
core/branches/flat/src/main/java/org/jboss/starobrno/OrderedSynchronizationHandler.java
Modified:
core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/branches/flat/src/main/java/org/jboss/starobrno/Cache.java
core/branches/flat/src/main/java/org/jboss/starobrno/CacheDelegate.java
core/branches/flat/src/main/java/org/jboss/starobrno/TxInterceptor.java
core/branches/flat/src/main/java/org/jboss/starobrno/factories/EmptyConstructorFactory.java
Log:
baching support added
Deleted: core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java 2008-10-09 09:55:17 UTC (rev 6895)
+++ core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java 2008-10-09 12:52:15 UTC (rev 6896)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.batch;
-
-import org.jboss.starobrno.CacheException;
-import org.jboss.starobrno.factories.annotations.Inject;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-/**
- * A container for holding thread locals for batching, to be used with the {@link org.jboss.cache.Cache_Legacy#startBatch()} and
- * {@link org.jboss.cache.Cache_Legacy#endBatch(boolean)} calls.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 3.0
- */
-public class BatchContainer
-{
- TransactionManager transactionManager;
- private ThreadLocal<Transaction> batchTransactionContainer = new ThreadLocal<Transaction>();
-
- @Inject
- void inject(TransactionManager transactionManager)
- {
- this.transactionManager = transactionManager;
- }
-
- public void startBatch() throws CacheException
- {
- try
- {
- if (transactionManager.getTransaction() != null) return;
- if (batchTransactionContainer.get() == null)
- {
- transactionManager.begin();
- batchTransactionContainer.set(transactionManager.suspend());
- }
- }
- catch (Exception e)
- {
- throw new CacheException("Unable to start batch", e);
- }
- }
-
- public void endBatch(boolean success)
- {
- Transaction tx = batchTransactionContainer.get();
- if (tx == null) return;
- Transaction existingTx = null;
- try
- {
- existingTx = transactionManager.getTransaction();
- transactionManager.resume(tx);
- if (success)
- tx.commit();
- else
- tx.rollback();
- }
- catch (Exception e)
- {
- throw new CacheException("Unable to end batch", e);
- }
- finally
- {
- batchTransactionContainer.remove();
- try
- {
- if (existingTx != null) transactionManager.resume(existingTx);
- }
- catch (Exception e)
- {
- throw new CacheException("Failed resuming existing transaction " + existingTx, e);
- }
- }
- }
-
- public Transaction getBatchTransaction()
- {
- return batchTransactionContainer.get();
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/BatchingInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/BatchingInterceptor.java 2008-10-09 09:55:17 UTC (rev 6895)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/BatchingInterceptor.java 2008-10-09 12:52:15 UTC (rev 6896)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.interceptors;
-
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.batch.BatchContainer;
-import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.interceptors.base.CommandInterceptor;
-import org.jboss.starobrno.factories.annotations.Inject;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-/**
- * Interceptor that captures batched calls and attaches contexts.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 3.0
- */
-public class BatchingInterceptor extends CommandInterceptor
-{
- BatchContainer batchContainer;
- TransactionManager transactionManager;
-
- @Inject
- private void inject(BatchContainer batchContainer, TransactionManager transactionManager)
- {
- this.batchContainer = batchContainer;
- this.transactionManager = transactionManager;
- }
-
- /**
- * Simply check if there is an ongoing tx.
- * <ul>
- * <li>If there is one, this is a no-op and just passes the call up the chain.</li>
- * <li>If there isn't one and there is a batch in progress, resume the batch's tx, pass up, and finally suspend the batch's tx.</li>
- * <li>If there is no batch in progress, just pass the call up the chain.</li>
- * </ul>
- */
- @Override
- protected Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
- {
- Transaction tx = null;
- try
- {
- // if in a batch, attach tx
- if (transactionManager.getTransaction() == null &&
- (tx = batchContainer.getBatchTransaction()) != null)
- {
- transactionManager.resume(tx);
- }
- return super.handleDefault(ctx, command);
- }
- finally
- {
- if (tx != null && transactionManager.getTransaction() != null)
- transactionManager.suspend();
- }
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-10-09 09:55:17 UTC (rev 6895)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-10-09 12:52:15 UTC (rev 6896)
@@ -34,7 +34,7 @@
import org.jboss.cache.Region;
import org.jboss.cache.RegionManager;
import org.jboss.cache.Version;
-import org.jboss.cache.batch.BatchContainer;
+import org.jboss.starobrno.batch.BatchContainer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.commands.CommandsFactory;
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/Cache.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/Cache.java 2008-10-09 09:55:17 UTC (rev 6895)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/Cache.java 2008-10-09 12:52:15 UTC (rev 6896)
@@ -53,4 +53,8 @@
AtomicGroup getAtomicGroup(K key);
CacheStatus getCacheStatus();
+
+ public void startBatch();
+
+ public void endBatch(boolean successful);
}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/CacheDelegate.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/CacheDelegate.java 2008-10-09 09:55:17 UTC (rev 6895)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/CacheDelegate.java 2008-10-09 12:52:15 UTC (rev 6896)
@@ -38,6 +38,7 @@
import org.jboss.starobrno.commands.write.RemoveCommand;
import org.jboss.starobrno.commands.write.ReplaceCommand;
import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.ConfigurationException;
import org.jboss.starobrno.context.InvocationContext;
import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
@@ -47,6 +48,7 @@
import org.jboss.starobrno.notifications.Notifier;
import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.transaction.TransactionTable;
+import org.jboss.starobrno.batch.BatchContainer;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
@@ -66,6 +68,7 @@
protected InterceptorChain invoker;
protected Configuration config;
protected Notifier notifier;
+ private BatchContainer batchContainer;
protected ComponentRegistry componentRegistry;
@Inject
@@ -336,4 +339,18 @@
{
return componentRegistry.getState();
}
+
+ public void startBatch()
+ {
+ if (!config.isInvocationBatchingEnabled())
+ throw new ConfigurationException("Invocation batching not enabled in current configuration! Please use the <invocationBatching /> element.");
+ batchContainer.startBatch();
+ }
+
+ public void endBatch(boolean successful)
+ {
+ if (!config.isInvocationBatchingEnabled())
+ throw new ConfigurationException("Invocation batching not enabled in current configuration! Please use the <invocationBatching /> element.");
+ batchContainer.endBatch(successful);
+ }
}
Deleted: core/branches/flat/src/main/java/org/jboss/starobrno/OrderedSynchronizationHandler.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/OrderedSynchronizationHandler.java 2008-10-09 09:55:17 UTC (rev 6895)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/OrderedSynchronizationHandler.java 2008-10-09 12:52:15 UTC (rev 6896)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.starobrno;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.transaction.RollbackException;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import java.util.LinkedList;
-
-/**
- * Maintains a list of Synchronization handlers. Reason is that we have to
- * invoke certain handlers <em>before</em> others. See the description in
- * SyncTxUnitTestCase.testConcurrentPuts(). For example, for synchronous
- * replication, we have to execute the ReplicationInterceptor's
- * afterCompletion() <em>before</em> the TransactionInterceptor's.
- *
- * @author Bela Ban
- * @version $Id$
- */
-public class OrderedSynchronizationHandler implements Synchronization
-{
- static final Log log = LogFactory.getLog(org.jboss.cache.interceptors.OrderedSynchronizationHandler.class);
-
- private Transaction tx = null;
- private final LinkedList<Synchronization> handlers = new LinkedList<Synchronization>();
-
- public OrderedSynchronizationHandler(Transaction tx) throws SystemException, RollbackException
- {
- this.tx = tx;
- tx.registerSynchronization(this);
- }
-
- public void registerAtHead(Synchronization handler)
- {
- register(handler, true);
- }
-
- public void registerAtTail(Synchronization handler)
- {
- register(handler, false);
- }
-
- void register(Synchronization handler, boolean head)
- {
- if (handler != null && !handlers.contains(handler))
- {
- if (head)
- handlers.addFirst(handler);
- else
- handlers.addLast(handler);
- }
- }
-
- public void beforeCompletion()
- {
- for (Synchronization sync : handlers)
- {
- sync.beforeCompletion();
- }
- }
-
- public void afterCompletion(int status)
- {
- RuntimeException exceptionInAfterCompletion = null;
- for (Synchronization sync : handlers)
- {
- try
- {
- sync.afterCompletion(status);
- }
- catch (Throwable t)
- {
- log.error("failed calling afterCompletion() on " + sync, t);
- exceptionInAfterCompletion = (RuntimeException) t;
- }
- }
-
- // throw the exception so the TM can deal with it.
- if (exceptionInAfterCompletion != null) throw exceptionInAfterCompletion;
- }
-
- @Override
- public String toString()
- {
- return "tx=" + getTxAsString() + ", handlers=" + handlers;
- }
-
- private String getTxAsString()
- {
- // JBCACHE-1114 -- don't call toString() on tx or it can lead to stack overflow
- if (tx == null)
- return null;
-
- return tx.getClass().getName() + "@" + System.identityHashCode(tx);
- }
-}
\ No newline at end of file
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/TxInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/TxInterceptor.java 2008-10-09 09:55:17 UTC (rev 6895)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/TxInterceptor.java 2008-10-09 12:52:15 UTC (rev 6896)
@@ -39,20 +39,13 @@
import org.jboss.starobrno.jmx.annotations.ManagedAttribute;
import org.jboss.starobrno.jmx.annotations.ManagedOperation;
import org.jboss.starobrno.lock.LockManager;
-import org.jboss.starobrno.notifier.Notifier;
+import org.jboss.starobrno.notifications.Notifier;
import org.jboss.starobrno.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.OrderedSynchronizationHandler;
import org.jboss.starobrno.transaction.TransactionTable;
-import javax.transaction.InvalidTransactionException;
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import javax.transaction.*;
+import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
Copied: core/branches/flat/src/main/java/org/jboss/starobrno/batch/BatchContainer.java (from rev 6895, core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/batch/BatchContainer.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/batch/BatchContainer.java 2008-10-09 12:52:15 UTC (rev 6896)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.batch;
+
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.factories.annotations.Inject;
+
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+/**
+ * A container for holding thread locals for batching, to be used with the {@link org.jboss.cache.Cache_Legacy#startBatch()} and
+ * {@link org.jboss.cache.Cache_Legacy#endBatch(boolean)} calls.
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+public class BatchContainer
+{
+ TransactionManager transactionManager;
+ private ThreadLocal<Transaction> batchTransactionContainer = new ThreadLocal<Transaction>();
+
+ @Inject
+ void inject(TransactionManager transactionManager)
+ {
+ this.transactionManager = transactionManager;
+ }
+
+ public void startBatch() throws CacheException
+ {
+ try
+ {
+ if (transactionManager.getTransaction() != null) return;
+ if (batchTransactionContainer.get() == null)
+ {
+ transactionManager.begin();
+ batchTransactionContainer.set(transactionManager.suspend());
+ }
+ }
+ catch (Exception e)
+ {
+ throw new CacheException("Unable to start batch", e);
+ }
+ }
+
+ public void endBatch(boolean success)
+ {
+ Transaction tx = batchTransactionContainer.get();
+ if (tx == null) return;
+ Transaction existingTx = null;
+ try
+ {
+ existingTx = transactionManager.getTransaction();
+ transactionManager.resume(tx);
+ if (success)
+ tx.commit();
+ else
+ tx.rollback();
+ }
+ catch (Exception e)
+ {
+ throw new CacheException("Unable to end batch", e);
+ }
+ finally
+ {
+ batchTransactionContainer.remove();
+ try
+ {
+ if (existingTx != null) transactionManager.resume(existingTx);
+ }
+ catch (Exception e)
+ {
+ throw new CacheException("Failed resuming existing transaction " + existingTx, e);
+ }
+ }
+ }
+
+ public Transaction getBatchTransaction()
+ {
+ return batchTransactionContainer.get();
+ }
+}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/factories/EmptyConstructorFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/factories/EmptyConstructorFactory.java 2008-10-09 09:55:17 UTC (rev 6895)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/factories/EmptyConstructorFactory.java 2008-10-09 12:52:15 UTC (rev 6896)
@@ -23,7 +23,7 @@
import org.jboss.cache.RegionRegistry;
-import org.jboss.cache.batch.BatchContainer;
+import org.jboss.starobrno.batch.BatchContainer;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.invocation.CacheInvocationDelegate;
import org.jboss.cache.loader.CacheLoaderManager;
Copied: core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/BatchingInterceptor.java (from rev 6895, core/branches/flat/src/main/java/org/jboss/cache/interceptors/BatchingInterceptor.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/BatchingInterceptor.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/BatchingInterceptor.java 2008-10-09 12:52:15 UTC (rev 6896)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.interceptors;
+
+import org.jboss.cache.InvocationContext;
+import org.jboss.starobrno.batch.BatchContainer;
+import org.jboss.cache.commands.VisitableCommand;
+import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.starobrno.factories.annotations.Inject;
+
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+/**
+ * Interceptor that captures batched calls and attaches contexts.
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+public class BatchingInterceptor extends CommandInterceptor
+{
+ BatchContainer batchContainer;
+ TransactionManager transactionManager;
+
+ @Inject
+ private void inject(BatchContainer batchContainer, TransactionManager transactionManager)
+ {
+ this.batchContainer = batchContainer;
+ this.transactionManager = transactionManager;
+ }
+
+ /**
+ * Simply check if there is an ongoing tx.
+ * <ul>
+ * <li>If there is one, this is a no-op and just passes the call up the chain.</li>
+ * <li>If there isn't one and there is a batch in progress, resume the batch's tx, pass up, and finally suspend the batch's tx.</li>
+ * <li>If there is no batch in progress, just pass the call up the chain.</li>
+ * </ul>
+ */
+ @Override
+ protected Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
+ {
+ Transaction tx = null;
+ try
+ {
+ // if in a batch, attach tx
+ if (transactionManager.getTransaction() == null &&
+ (tx = batchContainer.getBatchTransaction()) != null)
+ {
+ transactionManager.resume(tx);
+ }
+ return super.handleDefault(ctx, command);
+ }
+ finally
+ {
+ if (tx != null && transactionManager.getTransaction() != null)
+ transactionManager.suspend();
+ }
+ }
+}
More information about the jbosscache-commits
mailing list