Skip to content

Commit

Permalink
[ISPN-610] (Apply isStateTransferEnabled attribute to consumer only)
Browse files Browse the repository at this point in the history
  • Loading branch information
maniksurtani committed Sep 2, 2010
1 parent 9a26dce commit b5d6011
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Expand Up @@ -34,7 +34,7 @@
@DefaultFactoryFor(classes = StateTransferManager.class)
public class StateTransferManagerFactory extends AbstractNamedCacheComponentFactory implements AutoInstantiableFactory {
public <T> T construct(Class<T> componentType) {
if (configuration.getCacheMode().isClustered() && configuration.isStateTransferEnabled())
if (configuration.getCacheMode().isClustered() && !configuration.getCacheMode().isDistributed())
return componentType.cast(new StateTransferManagerImpl());
else
return null;
Expand Down
Expand Up @@ -114,17 +114,19 @@ public void start() throws StateTransferException {
transientState = configuration.isFetchInMemoryState();
persistentState = cs != null && clm.isEnabled() && clm.isFetchPersistentState() && !clm.isShared();

long startTime = 0;
if (log.isDebugEnabled()) {
log.debug("Initiating state transfer process");
startTime = System.currentTimeMillis();
}
if (transientState || persistentState) {
long startTime = 0;
if (log.isDebugEnabled()) {
log.debug("Initiating state transfer process");
startTime = System.currentTimeMillis();
}

rpcManager.retrieveState(cache.getName(), configuration.getStateRetrievalTimeout());
rpcManager.retrieveState(cache.getName(), configuration.getStateRetrievalTimeout());

if (log.isDebugEnabled()) {
long duration = System.currentTimeMillis() - startTime;
log.debug("State transfer process completed in {0}", Util.prettyPrintTime(duration));
if (log.isDebugEnabled()) {
long duration = System.currentTimeMillis() - startTime;
log.debug("State transfer process completed in {0}", Util.prettyPrintTime(duration));
}
}
}

Expand All @@ -141,8 +143,7 @@ public void generateState(OutputStream out) throws StateTransferException {
ObjectOutput oo = null;
boolean txLogActivated = false;
try {
boolean canProvideState = (transientState || persistentState)
&& (txLogActivated = transactionLog.activate());
boolean canProvideState = (txLogActivated = transactionLog.activate());
if (log.isDebugEnabled()) log.debug("Generating state. Can provide? {0}", canProvideState);
oo = marshaller.startObjectOutput(out, false);

Expand All @@ -152,7 +153,7 @@ public void generateState(OutputStream out) throws StateTransferException {

if (canProvideState) {
delimit(oo);
if (transientState) generateInMemoryState(oo);
generateInMemoryState(oo); // always provide in-memory state if requested. ISPN-610.
delimit(oo);
if (persistentState) generatePersistentState(oo);
delimit(oo);
Expand Down

0 comments on commit b5d6011

Please sign in to comment.