Author: manik.surtani(a)jboss.com
Date: 2009-02-27 07:52:48 -0500 (Fri, 27 Feb 2009)
New Revision: 7804
Modified:
core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
Log:
Potential fix for NBST + loaders
Modified:
core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2009-02-27
12:40:34 UTC (rev 7803)
+++
core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2009-02-27
12:52:48 UTC (rev 7804)
@@ -87,20 +87,22 @@
{
Fqn fqn = getFqn(rootNode);
boolean activated = false;
+ CacheLoader cacheLoader = cache.getCacheLoaderManager() == null ? null :
cache.getCacheLoaderManager().getCacheLoader();
+ boolean needToGeneratePersistentState = generatePersistent && cacheLoader
!= null;
try
{
cache.getMarshaller().objectToObjectStream(STATE_TRANSFER_VERSION, out);
- if (generateTransient)
+
+ // activate the tx log only if we need to generate either transient or
persistent state
+ if (nonBlocking && (generateTransient ||
needToGeneratePersistentState))
{
- if (nonBlocking)
- {
- activated = txLog.activate();
- if (! activated)
- throw new StateProviderBusyException("Busy performing state
transfer for someone else");
+ activated = txLog.activate();
+ if (! activated) throw new StateProviderBusyException("Busy performing
state transfer for someone else");
+ if (trace) log.trace("Transaction log activated!");
+ }
- if (trace) log.trace("Transaction log activated!");
- }
-
+ if (generateTransient)
+ {
//transient + marker
if (trace) log.trace("writing transient state for " + fqn);
marshallTransientState((InternalNode) rootNode, out);
@@ -121,11 +123,8 @@
delimitStream(out);
}
- CacheLoader cacheLoader = cache.getCacheLoaderManager() == null ? null :
cache.getCacheLoaderManager().getCacheLoader();
- if (cacheLoader != null && generatePersistent)
- {
- writePersistentData(out, fqn, cacheLoader);
- }
+ if (needToGeneratePersistentState) writePersistentData(out, fqn, cacheLoader);
+
delimitStream(out);
if (nonBlocking && generateTransient)
Show replies by date