[infinispan-commits] Infinispan SVN: r185 - in trunk/core/src/main/java/org/infinispan: invocation and 1 other directory.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Tue Apr 28 05:31:17 EDT 2009
Author: manik.surtani at jboss.com
Date: 2009-04-28 05:31:17 -0400 (Tue, 28 Apr 2009)
New Revision: 185
Modified:
trunk/core/src/main/java/org/infinispan/interceptors/DistributionInterceptor.java
trunk/core/src/main/java/org/infinispan/invocation/Flag.java
Log:
[ISPN-30] (DIST) Unreliable return values also now an invocation-specific flag
Modified: trunk/core/src/main/java/org/infinispan/interceptors/DistributionInterceptor.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/interceptors/DistributionInterceptor.java 2009-04-28 09:18:51 UTC (rev 184)
+++ trunk/core/src/main/java/org/infinispan/interceptors/DistributionInterceptor.java 2009-04-28 09:31:17 UTC (rev 185)
@@ -20,6 +20,7 @@
import org.infinispan.factories.annotations.Inject;
import org.infinispan.factories.annotations.Start;
import org.infinispan.interceptors.base.BaseRpcInterceptor;
+import org.infinispan.invocation.Flag;
import org.infinispan.remoting.transport.Address;
import org.infinispan.util.Immutables;
@@ -40,7 +41,7 @@
DistributionManager dm;
CommandsFactory cf;
DataContainer dataContainer;
- boolean isL1CacheEnabled, needReliableReturnValues, sync;
+ boolean isL1CacheEnabled, needReliableReturnValues;
static final RecipientGenerator CLEAR_COMMAND_GENERATOR = new RecipientGenerator() {
@@ -66,7 +67,6 @@
public void start() {
isL1CacheEnabled = configuration.isL1CacheEnabled();
needReliableReturnValues = !configuration.isUnsafeUnreliableReturnValues();
- sync = configuration.getCacheMode().isSynchronous();
}
// ---- READ commands
@@ -184,6 +184,8 @@
command = replicablePrepareCommand;
}
+ boolean sync = isSynchronous(ctx);
+
if (!skipReplicationOfTransactionMethod(ctx)) {
if (trace) {
log.trace("[" + rpcManager.getTransport().getAddress() + "] Running remote prepare for global tx {1}. Synchronous? {2}",
@@ -213,11 +215,15 @@
// a) unsafeUnreliableReturnValues is false
// b) unsafeUnreliableReturnValues is true, we are in a TX and the command is conditional
- if (needReliableReturnValues || (isConditionalCommand && ctx.getTransaction() != null)) {
+ if (isNeedReliableReturnValues(ctx) || (isConditionalCommand && ctx.getTransaction() != null)) {
for (Object k : keys) remoteGetAndStoreInL1(ctx, k);
}
}
+ private boolean isNeedReliableReturnValues(InvocationContext ctx) {
+ return !ctx.hasFlag(Flag.UNSAFE_UNRELIABLE_RETURN_VALUES) && needReliableReturnValues;
+ }
+
/**
* If we are within one transaction we won't do any replication as replication would only be performed at commit
* time. If the operation didn't originate locally we won't do any replication either.
Modified: trunk/core/src/main/java/org/infinispan/invocation/Flag.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/invocation/Flag.java 2009-04-28 09:18:51 UTC (rev 184)
+++ trunk/core/src/main/java/org/infinispan/invocation/Flag.java 2009-04-28 09:31:17 UTC (rev 185)
@@ -1,8 +1,23 @@
package org.infinispan.invocation;
/**
- * Available flags, which may be set on a per-invocation basis. These are provided using the {@link org.infinispan.AdvancedCache}
- * interface, using some of the overloaded methods that allow passing in of a variable number of Flags.
+ * Available flags, which may be set on a per-invocation basis. These are provided using the {@link
+ * org.infinispan.AdvancedCache} interface, using some of the overloaded methods that allow passing in of a variable
+ * number of Flags.
+ * <p/>
+ * <ul> <li>{@link #ZERO_LOCK_ACQUISITION_TIMEOUT} - overrides the {@link org.infinispan.config.Configuration#setLockAcquisitionTimeout(long)}
+ * configuration setting by ensuring lock managers use a 0 lock acquisition timeout.</li> <li>{@link #CACHE_MODE_LOCAL}
+ * - forces local mode even if the cache is configured to use a clustered mode like replication, invalidation or
+ * distribution</li> <li>{@link #SKIP_LOCKING} - bypasses lock acquisition altogether</li> <li>{@link #FORCE_WRITE_LOCK}
+ * - forces a write lock, even if the call is a read. Useful when reading an entry to later update it within the same
+ * transaction</li> <li>{@link #SKIP_CACHE_STATUS_CHECK} - skips checking whether a cache is in a receptive state, i.e.
+ * is {@link org.infinispan.lifecycle.ComponentStatus#RUNNING}. May break operation in weird ways!</li> <li>{@link
+ * #FORCE_ASYNCHRONOUS} - forces asynchronous network calls where possible</li> <li>{@link #FORCE_SYNCHRONOUS} - forces
+ * synchronous network calls where possible</li> <li>{@link #SKIP_CACHE_STORE} - skips storing an entry to any
+ * configured {@link org.infinispan.loader.CacheStore}s</li> <li>{@link #FAIL_SILENTLY} - swallows any exceptions,
+ * logging them instead at a low log level</li> <li>{@link #UNSAFE_UNRELIABLE_RETURN_VALUES} - when used with DIST cache
+ * mode, will skip retrieving a remote value before overwriting it, rendering return values for some operations (such as
+ * {@link org.infinispan.Cache#put(Object, Object)} or {@link org.infinispan.Cache#remove(Object)} unusable.</li> </ul>
*
* @author Manik Surtani
* @since 4.0
@@ -16,6 +31,6 @@
FORCE_ASYNCHRONOUS,
FORCE_SYNCHRONOUS,
SKIP_CACHE_STORE,
- FAIL_SILENTLY
-
+ FAIL_SILENTLY,
+ UNSAFE_UNRELIABLE_RETURN_VALUES
}
More information about the infinispan-commits
mailing list