You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by rv...@apache.org on 2015/04/28 23:40:24 UTC
[19/51] [partial] incubator-geode git commit: Init
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RegionShortcut.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RegionShortcut.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RegionShortcut.java
new file mode 100644
index 0000000..5000032
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RegionShortcut.java
@@ -0,0 +1,229 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire.cache;
+
+/**
+ * Each enum represents a predefined {@link RegionAttributes} in a {@link Cache}.
+ * These enum values can be used to create regions using a {@link RegionFactory}
+ * obtained by calling {@link Cache#createRegionFactory(RegionShortcut)}.
+ * <p>Another way to use predefined region attributes is in cache.xml by setting
+ * the refid attribute on a region element or region-attributes element to the
+ * string of each value.
+ * @since 6.5
+ * @author darrel
+ */
+public enum RegionShortcut {
+ /**
+ * A PARTITION has local state that is partitioned across each peer member
+ * that created the region.
+ * The actual RegionAttributes for a PARTITION region set the {@link DataPolicy} to {@link DataPolicy#PARTITION}.
+ */
+ PARTITION,
+ /**
+ * A PARTITION_REDUNDANT has local state that is partitioned across each peer member
+ * that created the region.
+ * In addition an extra copy of the data is kept in memory.
+ * The actual RegionAttributes for a PARTITION_REDUNDANT region set the {@link DataPolicy} to {@link DataPolicy#PARTITION} and the redundant-copies to 1.
+ */
+ PARTITION_REDUNDANT,
+ /**
+ * A PARTITION_PERSISTENT has local state that is partitioned across each peer member
+ * that created the region.
+ * In addition its state is written to disk and recovered from disk when the region
+ * is created.
+ * The actual RegionAttributes for a PARTITION_PERSISTENT region set the {@link DataPolicy} to {@link DataPolicy#PERSISTENT_PARTITION}.
+ */
+ PARTITION_PERSISTENT,
+ /**
+ * A PARTITION_REDUNDANT_PERSISTENT has local state that is partitioned across each peer member
+ * that created the region.
+ * In addition its state is written to disk and recovered from disk when the region
+ * is created.
+ * In addition an extra copy of the data is kept in memory.
+ * The actual RegionAttributes for a PARTITION_REDUNDANT_PERSISTENT region set the {@link DataPolicy} to {@link DataPolicy#PERSISTENT_PARTITION} and the redundant-copies to 1.
+ */
+ PARTITION_REDUNDANT_PERSISTENT,
+ /**
+ * A PARTITION_OVERFLOW has local state that is partitioned across each peer member
+ * that created the region.
+ * It will also move the values of entries to disk once it detects that the
+ * java vm is running low of memory.
+ * The actual RegionAttributes for a PARTITION_OVERFLOW region set the {@link DataPolicy} to {@link DataPolicy#PARTITION}.
+ * and {@link EvictionAttributes} are set to {@link EvictionAlgorithm#LRU_HEAP}
+ * with {@link EvictionAction#OVERFLOW_TO_DISK}.
+ */
+ PARTITION_OVERFLOW,
+ /**
+ * A PARTITION_REDUNDANT_OVERFLOW has local state that is partitioned across each peer member
+ * that created the region.
+ * In addition an extra copy of the data is kept in memory.
+ * It will also move the values of entries to disk once it detects that the
+ * java vm is running low of memory.
+ * The actual RegionAttributes for a PARTITION_REDUNDANT_OVERFLOW region set the {@link DataPolicy} to {@link DataPolicy#PARTITION}, the redundant-copies to 1,
+ * and {@link EvictionAttributes} are set to {@link EvictionAlgorithm#LRU_HEAP}
+ * with {@link EvictionAction#OVERFLOW_TO_DISK}.
+ */
+ PARTITION_REDUNDANT_OVERFLOW,
+ /**
+ * A PARTITION_PERSISTENT_OVERFLOW has local state that is partitioned across each peer member
+ * that created the region.
+ * In addition its state is written to disk and recovered from disk when the region
+ * is created.
+ * It will also remove the values of entries from memory once it detects that the
+ * java vm is running low of memory.
+ * The actual RegionAttributes for a PARTITION_PERSISTENT_OVERFLOW region set the {@link DataPolicy} to {@link DataPolicy#PERSISTENT_PARTITION}
+ * and {@link EvictionAttributes} are set to {@link EvictionAlgorithm#LRU_HEAP}
+ * with {@link EvictionAction#OVERFLOW_TO_DISK}.
+ */
+ PARTITION_PERSISTENT_OVERFLOW,
+ /**
+ * A PARTITION_REDUNDANT_PERSISTENT_OVERFLOW has local state that is partitioned across each peer member
+ * that created the region.
+ * In addition its state is written to disk and recovered from disk when the region
+ * is created.
+ * In addition an extra copy of the data is kept in memory.
+ * It will also remove the values of entries from memory once it detects that the
+ * java vm is running low of memory.
+ * The actual RegionAttributes for a PARTITION_REDUNDANT_PERSISTENT_OVERFLOW region set the {@link DataPolicy} to {@link DataPolicy#PERSISTENT_PARTITION}, the redundant-copies to 1,
+ * and {@link EvictionAttributes} are set to {@link EvictionAlgorithm#LRU_HEAP}
+ * with {@link EvictionAction#OVERFLOW_TO_DISK}.
+ */
+ PARTITION_REDUNDANT_PERSISTENT_OVERFLOW,
+ /**
+ * A PARTITION_HEAP_LRU has local state that is partitioned across each peer member
+ * that created the region.
+ * It will also destroy entries once it detects that the java vm is running low
+ * of memory.
+ * The actual RegionAttributes for a PARTITION_HEAP_LRU region set the {@link DataPolicy} to {@link DataPolicy#PARTITION}
+ * and {@link EvictionAttributes} are set to {@link EvictionAlgorithm#LRU_HEAP}
+ * with {@link EvictionAction#LOCAL_DESTROY}.
+ */
+ PARTITION_HEAP_LRU,
+ /**
+ * A PARTITION_REDUNDANT_HEAP_LRU has local state that is partitioned across each peer member
+ * that created the region.
+ * In addition an extra copy of the data is kept in memory.
+ * It will also destroy entries once it detects that the java vm is running low
+ * of memory.
+ * The actual RegionAttributes for a PARTITION_REDUNDANT_HEAP_LRU region set the {@link DataPolicy} to {@link DataPolicy#PARTITION}, the redundant-copies to 1,
+ * and {@link EvictionAttributes} are set to {@link EvictionAlgorithm#LRU_HEAP}
+ * with {@link EvictionAction#LOCAL_DESTROY}.
+ */
+ PARTITION_REDUNDANT_HEAP_LRU,
+
+ /**
+ * A REPLICATE has local state that is kept in sync with all other replicate
+ * regions that exist in its peers.
+ * The actual RegionAttributes for a REPLICATE region set the {@link DataPolicy} to {@link DataPolicy#REPLICATE} and {@link Scope} to {@link Scope#DISTRIBUTED_ACK}.
+ */
+ REPLICATE,
+ /**
+ * A REPLICATE_PERSISTENT has local state that is kept in sync with all other replicate
+ * regions that exist in its peers.
+ * In addition its state is written to disk and recovered from disk when the region
+ * is created.
+ * The actual RegionAttributes for a REPLICATE_PERSISTENT region set the {@link DataPolicy} to {@link DataPolicy#PERSISTENT_REPLICATE} and {@link Scope} to {@link Scope#DISTRIBUTED_ACK}.
+ */
+ REPLICATE_PERSISTENT,
+
+ /**
+ * A REPLICATE_OVERFLOW has local state that is kept in sync with all other replicate
+ * regions that exist in its peers.
+ * The actual RegionAttributes for a REPLICATE_OVERFLOW region set the {@link DataPolicy}
+ * to {@link DataPolicy#REPLICATE}, the {@link Scope} to {@link Scope#DISTRIBUTED_ACK}
+ * and {@link EvictionAttributes} are set to {@link EvictionAlgorithm#LRU_HEAP}
+ * with {@link EvictionAction#OVERFLOW_TO_DISK}.
+ */
+ REPLICATE_OVERFLOW,
+ /**
+ * A REPLICATE_PERSISTENT_OVERFLOW has local state that is kept in sync with all other replicate
+ * regions that exist in its peers.
+ * In addition its state is written to disk and recovered from disk when the region
+ * is created.
+ * It will also remove the values of entries from memory once it detects that the
+ * java vm is running low of memory.
+ * The actual RegionAttributes for a REPLICATE_PERSISTENT_OVERFLOW region set the {@link DataPolicy}
+ * to {@link DataPolicy#PERSISTENT_REPLICATE}, the {@link Scope} to {@link Scope#DISTRIBUTED_ACK},
+ * and {@link EvictionAttributes} are set to {@link EvictionAlgorithm#LRU_HEAP}
+ * with {@link EvictionAction#OVERFLOW_TO_DISK}.
+ */
+ REPLICATE_PERSISTENT_OVERFLOW,
+ /**
+ * A REPLICATE_HEAP_LRU has local state that is kept in sync with all other replicate
+ * regions that exist in its peers.
+ * It will also destroy entries once it detects that the java vm is running low
+ * of memory.
+ * The actual RegionAttributes for a REPLICATE_HEAP_LRU region set the {@link DataPolicy} to {@link DataPolicy#PRELOADED}, the {@link Scope} to {@link Scope#DISTRIBUTED_ACK},
+ * {@link SubscriptionAttributes} to {@link InterestPolicy#ALL},
+ * and {@link EvictionAttributes} are set to {@link EvictionAlgorithm#LRU_HEAP}
+ * with {@link EvictionAction#LOCAL_DESTROY}.
+ */
+ REPLICATE_HEAP_LRU,
+
+ /**
+ * A LOCAL region only has local state and never sends operations to others.
+ * The actual RegionAttributes for a LOCAL region set the {@link DataPolicy} to {@link DataPolicy#NORMAL}.
+ */
+ LOCAL,
+ /**
+ * A LOCAL_PERSISTENT region only has local state and never sends operations to others
+ * but it does write its state to disk and can recover that state when the region
+ * is created.
+ * The actual RegionAttributes for a LOCAL_PERSISTENT region set the {@link DataPolicy} to {@link DataPolicy#PERSISTENT_REPLICATE}.
+ */
+ LOCAL_PERSISTENT,
+
+ /**
+ * A LOCAL_HEAP_LRU region only has local state and never sends operations to others.
+ * It will also destroy entries once it detects that the java vm is running low
+ * of memory.
+ * The actual RegionAttributes for a LOCAL_HEAP_LRU region set the {@link DataPolicy} to {@link DataPolicy#NORMAL} and {@link EvictionAttributes} are set to {@link EvictionAlgorithm#LRU_HEAP}
+ * with {@link EvictionAction#LOCAL_DESTROY}.
+ */
+ LOCAL_HEAP_LRU,
+ /**
+ * A LOCAL_OVERFLOW region only has local state and never sends operations to others.
+ * It will also move the values of entries to disk once it detects that the
+ * java vm is running low of memory.
+ * The actual RegionAttributes for a LOCAL_OVERFLOW region set the {@link DataPolicy} to {@link DataPolicy#NORMAL} and {@link EvictionAttributes} are set to {@link EvictionAlgorithm#LRU_HEAP}
+ * with {@link EvictionAction#OVERFLOW_TO_DISK}.
+ */
+ LOCAL_OVERFLOW,
+ /**
+ * A LOCAL_PERSISTENT_OVERFLOW region only has local state and never sends operations to others
+ * but it does write its state to disk and can recover that state when the region
+ * is created.
+ * It will also remove the values of entries from memory once it detects that the
+ * java vm is running low of memory.
+ * The actual RegionAttributes for a LOCAL_PERSISTENT_OVERFLOW region set the {@link DataPolicy} to {@link DataPolicy#PERSISTENT_REPLICATE} and {@link EvictionAttributes} are set to {@link EvictionAlgorithm#LRU_HEAP}
+ * with {@link EvictionAction#OVERFLOW_TO_DISK}.
+ */
+ LOCAL_PERSISTENT_OVERFLOW,
+
+ /**
+ * A PARTITION_PROXY has no local state and forwards all operations to a PARTITION
+ * or a PARTITION_PERSISTENT that exists in its peers.
+ * The actual RegionAttributes for a PARTITION_PROXY region set the {@link DataPolicy} to {@link DataPolicy#PARTITION} and the local-max-memory to 0.
+ */
+ PARTITION_PROXY,
+ /**
+ * A PARTITION_PROXY_REDUNDANT has no local state and forwards all operations to a PARTITION_REDUNDANT
+ * or a PARTITION_REDUNDANT_PERSISTENT that exists in its peers.
+ * The actual RegionAttributes for a PARTITION_PROXY_REDUNDANT region set the {@link DataPolicy} to {@link DataPolicy#PARTITION}, the local-max-memory to 0,
+ * and the redundant-copies to 1.
+ */
+ PARTITION_PROXY_REDUNDANT,
+ /**
+ * A REPLICATE_PROXY has no local state and forwards all operations (except queries) to a REPLICATE
+ * or a REPLICATE_PERSISTENT that exists in its peers.
+ * Queries will be executed on this PROXY region.
+ * The actual RegionAttributes for a REPLICATE_PROXY region set the {@link DataPolicy} to {@link DataPolicy#EMPTY} and {@link Scope} to {@link Scope#DISTRIBUTED_ACK}.
+ */
+ REPLICATE_PROXY,
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RemoteTransactionException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RemoteTransactionException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RemoteTransactionException.java
new file mode 100755
index 0000000..352ed3d
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RemoteTransactionException.java
@@ -0,0 +1,33 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+/**
+ * Indicates that an unexpected runtime exception occurred
+ * during a cache operation on the transactional data host.
+ *
+ * <p>This exception only occurs when a transaction
+ * is hosted on a member that is not
+ * the initiator of the transaction.
+ *
+ * @author gregp
+ * @since 6.5
+ * @deprecated as of 6.6 exceptions from a remote node are no longer wrapped in this exception. Instead of this, {@link TransactionDataNodeHasDepartedException} is thrown.
+ */
+public class RemoteTransactionException extends TransactionException {
+
+ private static final long serialVersionUID = -2217135580436381984L;
+
+ public RemoteTransactionException(String s) {
+ super(s);
+ }
+
+ public RemoteTransactionException(Exception e) {
+ super(e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RequiredRoles.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RequiredRoles.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RequiredRoles.java
new file mode 100755
index 0000000..41fa829
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RequiredRoles.java
@@ -0,0 +1,108 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+import com.gemstone.gemfire.distributed.Role;
+import com.gemstone.gemfire.internal.Assert;
+import com.gemstone.gemfire.internal.cache.DistributedRegion;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+
+import java.util.*;
+
+/**
+ * Provides information on presence or absence of a <code>Region</code>'s
+ * required roles. Configuration of required roles is accomplished using the
+ * <code>Region</code>'s {@link MembershipAttributes}.
+ *
+ * A {@link com.gemstone.gemfire.distributed.Role Role} may be present in the
+ * distributed system even if it the <code>Role</code> is not present in the
+ * <code>Region</code> membership. This would occur if none of the members
+ * filling that <code>Role</code> currently have a <code>Cache</code> or the
+ * specific <code>Region</code> created. In this case the <code>Role</code> is
+ * considered to be absent for that <code>Region</code>.
+ *
+ * @author Kirk Lund
+ * @see com.gemstone.gemfire.distributed.Role
+ * @since 5.0
+ */
+public class RequiredRoles {
+
+ /**
+ * Returns a set of any currently missing required roles for the
+ * specified region. If the region is not configured to require roles
+ * an empty set will always be returned.
+ *
+ * @param region the region to check for missing required roles
+ * @return set of required roles that are currently missing
+ * @throws IllegalStateException if region is not configured with required roles
+ */
+ public static Set<Role> checkForRequiredRoles(Region<?,?> region) {
+ try {
+ return waitForRequiredRoles(region, 0);
+ }
+ catch (InterruptedException ie) {
+ // This could happen if we were in an interrupted state
+ // upon method entry
+ Thread.currentThread().interrupt();
+ ((LocalRegion)region).getCancelCriterion().checkCancelInProgress(ie);
+ Assert.assertTrue(false,
+ "checkForRequiredRoles cannot throw InterruptedException");
+ return Collections.emptySet(); // keep compiler happy
+ }
+ }
+
+ /**
+ * Returns a set of any currently missing required roles for the
+ * specified region. This will wait the specified timeout in milliseconds
+ * for any missing required roles to be filled. If there are no missing
+ * required roles or if the region is not configured to require any roles
+ * then an empty set will immediately be returned.
+ *
+ * @param region the region to check for missing required roles
+ * @param timeout milliseconds to wait for any missing required roles
+ * @return set of required roles that are currently missing
+ * @throws NullPointerException if region is null
+ * @throws InterruptedException if thread is interrupted while waiting
+ * @throws IllegalStateException if region is not configured with required roles
+ */
+ public static Set<Role> waitForRequiredRoles(Region<?,?> region, long timeout)
+ throws InterruptedException {
+// if (Thread.interrupted()) throw new InterruptedException(); not necessary waitForRequiredRoles does this
+ if (region == null) {
+ throw new NullPointerException(LocalizedStrings.RequiredRoles_REGION_MUST_BE_SPECIFIED.toLocalizedString());
+ }
+ if (!(region instanceof DistributedRegion)) {
+ throw new IllegalStateException(LocalizedStrings.RequiredRoles_REGION_HAS_NOT_BEEN_CONFIGURED_WITH_REQUIRED_ROLES.toLocalizedString());
+ }
+ DistributedRegion dr = (DistributedRegion) region;
+ return dr.waitForRequiredRoles(timeout);
+ }
+
+ /**
+ * Returns true if the {@link com.gemstone.gemfire.distributed.Role Role}
+ * is currently present in the {@link Region} membership. This returns true
+ * only if one or more members filling this role actually have the region
+ * currently created. The role may be present in the distributed system even
+ * if the role is not present in the region membership.
+ *
+ * @param region the region whose membership will be searched
+ * @param role the role to check for
+ */
+ public static boolean isRoleInRegionMembership(Region<?,?> region, Role role) {
+ if (region instanceof DistributedRegion) {
+ DistributedRegion dr = (DistributedRegion) region;
+ return dr.isRoleInRegionMembership(role);
+ }
+ else {
+ return role.isPresent();
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ResourceException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ResourceException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ResourceException.java
new file mode 100644
index 0000000..31d0575
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ResourceException.java
@@ -0,0 +1,52 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire.cache;
+
+/**
+ * A Generic exception to indicate that a resource exception has occurred.
+ * This class is abstract so that only subclasses can be instantiated.
+ *
+ * @author sbawaska
+ * @since 6.0
+ */
+public abstract class ResourceException extends CacheRuntimeException {
+ /**
+ * Creates a new instance of <code>ResourceException</code> without detail message.
+ */
+ public ResourceException() {
+ }
+
+
+ /**
+ * Constructs an instance of <code>ResourceException</code> with the specified detail message.
+ * @param msg the detail message
+ */
+ public ResourceException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an instance of <code>ResourceException</code> with the specified detail message
+ * and cause.
+ * @param msg the detail message
+ * @param cause the causal Throwable
+ */
+ public ResourceException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+ /**
+ * Constructs an instance of <code>ResourceException</code> with the specified cause.
+ * @param cause the causal Throwable
+ */
+ public ResourceException(Throwable cause) {
+ super(cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ResumptionAction.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ResumptionAction.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ResumptionAction.java
new file mode 100755
index 0000000..e0d2615
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ResumptionAction.java
@@ -0,0 +1,105 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Specifies how the region is affected by resumption of reliability when
+ * one or more missing required roles return to the distributed membership.
+ * The <code>ResumptionAction</code> is specified when configuring a region's
+ * {@link com.gemstone.gemfire.cache.MembershipAttributes}.
+ *
+ * @author Kirk Lund
+ * @since 5.0
+ */
+public class ResumptionAction implements java.io.Serializable {
+ private static final long serialVersionUID = 6632254151314915610L;
+
+ /** No special action takes place when reliability resumes. */
+ public static final ResumptionAction NONE =
+ new ResumptionAction("NONE");
+
+ /**
+ * Resumption of reliability causes the region to be cleared of all data
+ * and {@link DataPolicy#withReplication replicated} regions will do a new
+ * getInitialImage operation to repopulate the region. Any existing
+ * references to this region become unusable in that any subsequent methods
+ * invoked on those references will throw a {@link
+ * RegionReinitializedException}.
+ */
+ public static final ResumptionAction REINITIALIZE =
+ new ResumptionAction("REINITIALIZE");
+
+ /** The name of this mirror type. */
+ private final transient String name;
+
+ // The 4 declarations below are necessary for serialization
+ /** byte used as ordinal to represent this Scope */
+ public final byte ordinal = nextOrdinal++;
+
+ private static byte nextOrdinal = 0;
+
+ private static final ResumptionAction[] PRIVATE_VALUES =
+ { NONE, REINITIALIZE };
+
+ /** List of all ResumptionAction values */
+ public static final List VALUES =
+ Collections.unmodifiableList(Arrays.asList(PRIVATE_VALUES));
+
+ private Object readResolve() throws ObjectStreamException {
+ return PRIVATE_VALUES[ordinal]; // Canonicalize
+ }
+
+ /** Creates a new instance of ResumptionAction. */
+ private ResumptionAction(String name) {
+ this.name = name;
+ }
+
+ /** Return the ResumptionAction represented by specified ordinal */
+ public static ResumptionAction fromOrdinal(byte ordinal) {
+ return PRIVATE_VALUES[ordinal];
+ }
+
+ /** Return the ResumptionAction specified by name */
+ public static ResumptionAction fromName(String name) {
+ if (name == null || name.length() == 0) {
+ throw new IllegalArgumentException(LocalizedStrings.ResumptionAction_INVALID_RESUMPTIONACTION_NAME_0.toLocalizedString(name));
+ }
+ for (int i = 0; i < PRIVATE_VALUES.length; i++) {
+ if (name.equals(PRIVATE_VALUES[i].name)) {
+ return PRIVATE_VALUES[i];
+ }
+ }
+ throw new IllegalArgumentException(LocalizedStrings.ResumptionAction_INVALID_RESUMPTIONACTION_NAME_0.toLocalizedString(name));
+ }
+
+ /** Returns true if this is <code>NONE</code>. */
+ public boolean isNone() {
+ return this == NONE;
+ }
+
+ /** Returns true if this is <code>REINITIALIZE</code>. */
+ public boolean isReinitialize() {
+ return this == REINITIALIZE;
+ }
+
+ /**
+ * Returns a string representation for this resumption action.
+ * @return the name of this resumption action
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RoleEvent.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RoleEvent.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RoleEvent.java
new file mode 100755
index 0000000..40ef361
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RoleEvent.java
@@ -0,0 +1,30 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire.cache;
+
+import java.util.Set;
+
+/**
+ * Contains information about an event affecting a region reliability,
+ * including its identity and the circumstances of the event. This is
+ * passed in to {@link RegionRoleListener}.
+ *
+ * @author Kirk Lund
+ * @see RegionRoleListener
+ * @since 5.0
+ */
+public interface RoleEvent<K,V> extends RegionEvent<K,V> {
+
+ /**
+ * Returns the required roles that were lost or gained because of this
+ * event.
+ */
+ public Set<String> getRequiredRoles();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RoleException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RoleException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RoleException.java
new file mode 100755
index 0000000..98b55d6
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/RoleException.java
@@ -0,0 +1,59 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+/**
+ * <code>RoleException</code> is the superclass of those exceptions
+ * that can be thrown to indicate a reliability failure on one or more {@link
+ * Region regions} that have been configured with required roles using
+ * {@link MembershipAttributes}.
+ *
+ * @author Kirk Lund
+ * @since 5.0
+ */
+public abstract class RoleException extends CacheRuntimeException {
+ private static final long serialVersionUID = -7521056108445887394L;
+
+ /**
+ * Creates a new instance of <code>RoleException</code> without
+ * detail message.
+ */
+ public RoleException() {
+ }
+
+
+ /**
+ * Constructs an instance of <code>RoleException</code> with the
+ * specified detail message.
+ * @param msg the detail message
+ */
+ public RoleException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an instance of <code>RoleException</code> with the
+ * specified detail message and cause.
+ * @param msg the detail message
+ * @param cause the causal Throwable
+ */
+ public RoleException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+ /**
+ * Constructs an instance of <code>RoleException</code> with the
+ * specified cause.
+ * @param cause the causal Throwable
+ */
+ public RoleException(Throwable cause) {
+ super(cause);
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/Scope.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/Scope.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/Scope.java
new file mode 100644
index 0000000..b2576f9
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/Scope.java
@@ -0,0 +1,159 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+
+package com.gemstone.gemfire.cache;
+
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+
+import java.io.*;
+
+/**
+ * Enumerated type for region distribution scope.
+ *
+ * @author Eric Zoerner
+ *
+ *
+ * @see RegionAttributes#getScope
+ * @see AttributesFactory#setScope
+ * @since 3.0
+ */
+public class Scope implements Serializable {
+ private static final long serialVersionUID = 5534399159504301602L;
+
+ /** The region with this attribute is scoped to this JVM only. Operations and data
+ * are not distributed to other caches.
+ */
+ public static final Scope LOCAL = new Scope("LOCAL");
+
+ /** The region or cached object with this attribute is scoped
+ * to the distributed cached system; any distributed
+ * operation will return without waiting for the remote acknowledgment.
+ */
+ public static final Scope DISTRIBUTED_NO_ACK = new Scope("DISTRIBUTED_NO_ACK");
+
+ /**
+ * The region or cached object with this attribute is scoped
+ * to the distributed cached system; any distributed
+ * operation will not return until all the remote acknowledgments
+ * come back.
+ */
+ public static final Scope DISTRIBUTED_ACK = new Scope("DISTRIBUTED_ACK");
+
+ /**
+ * The region or cached object with this attribute is scoped
+ * to the distributed cached system; locking is used
+ * for all distributed operations on entries
+ * to guarantee consistency across the distributed caches.
+ */
+ public static final Scope GLOBAL = new Scope("GLOBAL");
+
+ /** The name of this scope.*/
+ private final transient String name;
+
+ // The 4 declarations below are necessary for serialization
+ /** int used as ordinal to represent this Scope */
+ public final int ordinal = nextOrdinal++;
+
+ private static int nextOrdinal = 0;
+
+ private static final Scope[] VALUES =
+ { LOCAL, DISTRIBUTED_NO_ACK, DISTRIBUTED_ACK, GLOBAL };
+
+ /* The following 4 definitions are included for use by the C
+ * interface. Any changes to the order of the scopes in VALUES
+ * must be reflected here and changed in gemfire.h.
+ */
+ final static int SCOPE_LOCAL = 0;
+ final static int SCOPE_DISTRIBUTED_NO_ACK= 1;
+ final static int SCOPE_DISTRIBUTED_ACK = 2;
+ final static int SCOPE_GLOBAL = 3;
+
+ private Object readResolve() throws ObjectStreamException {
+ return fromOrdinal(ordinal); // Canonicalize
+ }
+
+
+ /** Creates a new instance of Scope. */
+ private Scope(String name) {
+ this.name = name;
+ }
+
+ /** Return the Scope represented by specified ordinal */
+ public static Scope fromOrdinal(int ordinal) {
+ return VALUES[ordinal];
+ }
+
+ /** Returns whether this is local scope.
+ * @return true if this is LOCAL
+ */
+ public boolean isLocal() {
+ return this == LOCAL;
+ }
+
+ /** Returns whether this is one of the distributed scopes.
+ * @return true if this is any scope other than LOCAL
+ */
+ public boolean isDistributed() {
+ return this != LOCAL;
+ }
+
+ /** Returns whether this is distributed no ack scope.
+ * @return true if this is DISTRIBUTED_NO_ACK
+ */
+ public boolean isDistributedNoAck() {
+ return this == DISTRIBUTED_NO_ACK;
+ }
+
+ /** Returns whether this is distributed ack scope.
+ * @return true if this is DISTRIBUTED_ACK
+ */
+ public boolean isDistributedAck() {
+ return this == DISTRIBUTED_ACK;
+ }
+
+ /** Returns whether this is global scope.
+ * @return true if this is GLOBAL
+ */
+ public boolean isGlobal() {
+ return this == GLOBAL;
+ }
+
+ /** Returns whether acknowledgements are required for this scope.
+ * @return true if this is DISTRIBUTED_ACK or GLOBAL, false otherwise
+ */
+ public boolean isAck() {
+ return this == DISTRIBUTED_ACK || this == GLOBAL;
+ }
+
+
+ /** Returns a string representation for this scope.
+ * @return String the name of this scope
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ /**
+ * Parse the given string into a Scope
+ * @param scope the provided String form of Scope
+ * @return the canonical Scope associated with the string
+ */
+ public static Scope fromString(String scope) {
+ for (int i=0; i<VALUES.length; i++) {
+ if (VALUES[i].toString().equals(scope)) {
+ return VALUES[i];
+ }
+ }
+ throw new IllegalArgumentException(
+ LocalizedStrings.Scope_0_IS_NOT_A_VALID_STRING_REPRESENTATION_OF_1
+ .toLocalizedString(new Object[] {scope, Scope.class.getName()}));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/SerializedCacheValue.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/SerializedCacheValue.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/SerializedCacheValue.java
new file mode 100755
index 0000000..33f60f3
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/SerializedCacheValue.java
@@ -0,0 +1,40 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire.cache;
+
+/**
+ * Class <code>SerializedCacheValue</code> represents a serialized cache value.
+ * Instances of this class obtained from a region can be put into another region
+ * without a copy of this value being made. The two region entries will both have a
+ * reference to the same value.
+ * <p>
+ * If this value originated from a region stored off heap then this object can
+ * only be used as long as notification method that obtained it has not returned.
+ * For example if your implementation of {@link CacheListener#afterUpdate(EntryEvent)} obtains one
+ * by calling {@link EntryEvent#getSerializedOldValue()} then the SerializedCacheValue returned
+ * is only valid until your afterUpdate method returns. It is not safe to store instances of this
+ * class and use them later when using off heap storage.
+ *
+ * @author Barry Oglesby
+ * @since 5.5
+ */
+public interface SerializedCacheValue<V> {
+
+ /**
+ * Returns the raw byte[] that represents this cache value.
+ * @return the raw byte[] that represents this cache value
+ */
+ public byte[] getSerializedValue();
+
+ /**
+ * Returns the deserialized object for this cache value.
+ * @return the deserialized object for this cache value
+ */
+ public V getDeserializedValue();
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/StatisticsDisabledException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/StatisticsDisabledException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/StatisticsDisabledException.java
new file mode 100644
index 0000000..846b278
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/StatisticsDisabledException.java
@@ -0,0 +1,59 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire.cache;
+
+/**
+ * Thrown if statistics are requested when statistics are disabled on the
+ * region.
+ *
+ * @author Eric Zoerner
+ *
+ *
+ * @see AttributesFactory#setStatisticsEnabled
+ * @see RegionAttributes#getStatisticsEnabled
+ * @see Region#getStatistics
+ * @see Region.Entry#getStatistics
+ * @since 3.0
+ */
+public class StatisticsDisabledException extends CacheRuntimeException {
+private static final long serialVersionUID = -2987721454129719551L;
+
+ /**
+ * Creates a new instance of <code>StatisticsDisabledException</code> without detail message.
+ */
+ public StatisticsDisabledException() {
+ }
+
+
+ /**
+ * Constructs an instance of <code>StatisticsDisabledException</code> with the specified detail message.
+ * @param msg the detail message
+ */
+ public StatisticsDisabledException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an instance of <code>StatisticsDisabledException</code> with the specified detail message
+ * and cause.
+ * @param msg the detail message
+ * @param cause the causal Throwable
+ */
+ public StatisticsDisabledException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+ /**
+ * Constructs an instance of <code>StatisticsDisabledException</code> with the specified cause.
+ * @param cause the causal Throwable
+ */
+ public StatisticsDisabledException(Throwable cause) {
+ super(cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/SubscriptionAttributes.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/SubscriptionAttributes.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/SubscriptionAttributes.java
new file mode 100644
index 0000000..2bf2f35
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/SubscriptionAttributes.java
@@ -0,0 +1,108 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+import com.gemstone.gemfire.DataSerializable;
+import java.io.*;
+
+/**
+ * Configuration attributes for defining subscriber requirements and behavior
+ * for a <code>Region</code>.
+ *
+ * <p>The {@link InterestPolicy} defines what remote operation's data/event
+ * are of interest to this cache's region.</p>
+ *
+ * @author Darrel
+ * @since 5.0
+ */
+public class SubscriptionAttributes implements DataSerializable, Externalizable {
+
+ /**
+ * this subscriber's interest policy
+ */
+ private /*final*/ InterestPolicy interestPolicy;
+
+ /**
+ * Creates a new <code>SubscriptionAttributes</code> with the default
+ * configuration
+ */
+ public SubscriptionAttributes() {
+ this.interestPolicy = InterestPolicy.DEFAULT;
+ }
+ /**
+ * Creates a new <code>SubscriptionAttributes</code> with the given
+ * interest policy.
+ * @param interestPolicy the interest policy this subscriber will use
+ */
+ public SubscriptionAttributes(InterestPolicy interestPolicy) {
+ this.interestPolicy = interestPolicy;
+ }
+ /**
+ * Returns the interest policy of this subscriber.
+ */
+ public InterestPolicy getInterestPolicy() {
+ return this.interestPolicy;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) return true;
+ if (other == null) return false;
+ if (!(other instanceof SubscriptionAttributes)) return false;
+ final SubscriptionAttributes that = (SubscriptionAttributes) other;
+
+ if (this.interestPolicy != that.interestPolicy &&
+ !(this.interestPolicy != null &&
+ this.interestPolicy.equals(that.interestPolicy))) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ final int mult = 37;
+
+ result = mult * result + this.interestPolicy.hashCode();
+
+ return result;
+ }
+
+ /**
+ * Returns a string representation of the object.
+ *
+ * @return a string representation of the object
+ */
+ @Override
+ public String toString() {
+ final StringBuffer sb = new StringBuffer();
+ sb.append("InterestPolicy=");
+ sb.append(this.interestPolicy.toString());
+ return sb.toString();
+ }
+
+ public void toData(DataOutput out) throws IOException {
+ out.writeByte(this.interestPolicy.ordinal);
+ }
+
+ public void fromData(DataInput in)
+ throws IOException, ClassNotFoundException {
+ this.interestPolicy = InterestPolicy.fromOrdinal(in.readByte());
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ // added to fix bug 36619
+ toData(out);
+ }
+
+ public void readExternal(ObjectInput in)
+ throws IOException, ClassNotFoundException {
+ // added to fix bug 36619
+ fromData(in);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/SynchronizationCommitConflictException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/SynchronizationCommitConflictException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/SynchronizationCommitConflictException.java
new file mode 100644
index 0000000..7b40afd
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/SynchronizationCommitConflictException.java
@@ -0,0 +1,40 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire.cache;
+
+/** Thrown when a commit operation of a JTA enlisted cache transaction fails
+ *
+ * @author Mitch Thomas
+ *
+ * @see javax.transaction.UserTransaction#commit
+ * @since 4.0
+ */
+public class SynchronizationCommitConflictException extends CacheRuntimeException {
+private static final long serialVersionUID = 2619806460255259492L;
+ /**
+ * Constructs an instance of
+ * <code>SynchronizationCommitConflictException</code> with the
+ * specified detail message.
+ * @param msg the detail message
+ */
+ public SynchronizationCommitConflictException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an instance of
+ * <code>SynchronizationCommitConflictException</code> with the
+ * specified detail message and cause.
+ * @param msg the detail message
+ * @param cause the causal Throwable
+ */
+ public SynchronizationCommitConflictException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TimeoutException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TimeoutException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TimeoutException.java
new file mode 100644
index 0000000..761815d
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TimeoutException.java
@@ -0,0 +1,64 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire.cache;
+
+/** Thrown if a <code>netSearch</code> times out without getting a response back from a cache,
+ * or when attempting to acquire a distributed lock.
+ *
+ * @author Eric Zoerner
+ *
+ *
+ * @see LoaderHelper#netSearch
+ * @see com.gemstone.gemfire.cache.Region#invalidateRegion()
+ * @see com.gemstone.gemfire.cache.Region#destroyRegion()
+ * @see Region#createSubregion
+ * @see com.gemstone.gemfire.cache.Region#get(Object)
+ * @see com.gemstone.gemfire.cache.Region#put(Object, Object)
+ * @see com.gemstone.gemfire.cache.Region#create(Object, Object)
+ * @see com.gemstone.gemfire.cache.Region#invalidate(Object)
+ * @see com.gemstone.gemfire.cache.Region#destroy(Object)
+ * @see com.gemstone.gemfire.distributed.DistributedLockService
+ * @since 3.0
+ */
+public class TimeoutException extends OperationAbortedException {
+private static final long serialVersionUID = -6260761691185737442L;
+
+ /**
+ * Creates a new instance of <code>TimeoutException</code> without detail message.
+ */
+ public TimeoutException() {
+ }
+
+
+ /**
+ * Constructs an instance of <code>TimeoutException</code> with the specified detail message.
+ * @param msg the detail message
+ */
+ public TimeoutException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an instance of <code>TimeoutException</code> with the specified detail message
+ * and cause.
+ * @param msg the detail message
+ * @param cause the causal Throwable
+ */
+ public TimeoutException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+ /**
+ * Constructs an instance of <code>TimeoutException</code> with the specified cause.
+ * @param cause the causal Throwable
+ */
+ public TimeoutException(Throwable cause) {
+ super(cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionDataNodeHasDepartedException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionDataNodeHasDepartedException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionDataNodeHasDepartedException.java
new file mode 100755
index 0000000..6ccb41b
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionDataNodeHasDepartedException.java
@@ -0,0 +1,33 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+/**
+ * Thrown when the transactional data host has shutdown or no longer has the data
+ * being modified by the transaction.
+ * This can be thrown while doing transactional operations or during commit.
+ *
+ * <p>This exception only occurs when a transaction
+ * is hosted on a member that is not
+ * the initiator of the transaction.
+ *
+ * @author gregp
+ * @since 6.5
+ */
+public class TransactionDataNodeHasDepartedException extends TransactionException {
+
+ private static final long serialVersionUID = -2217135580436381984L;
+
+ public TransactionDataNodeHasDepartedException(String s) {
+ super(s);
+ }
+
+ public TransactionDataNodeHasDepartedException(Throwable e) {
+ super(e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionDataNotColocatedException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionDataNotColocatedException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionDataNotColocatedException.java
new file mode 100755
index 0000000..abcc313
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionDataNotColocatedException.java
@@ -0,0 +1,37 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+/**
+ * Indicates that an attempt was made to transactionally modify multiple keys that
+ * are not colocated on the same data host.
+ * This can be thrown while doing transactional operations or during commit.
+ *
+ * <p>This exception only occurs when a transaction
+ * is hosted on a member that is not
+ * the initiator of the transaction.
+ *
+ * <p>Note: a rebalance can cause this exception to be thrown for data that
+ * is usually colocated. This is because data can be moved from one node to another
+ * during the time between the original transactional operations and the commit.
+ *
+ * @author gregp
+ * @since 6.5
+ */
+public class TransactionDataNotColocatedException extends TransactionException {
+
+ private static final long serialVersionUID = -2217135580436381984L;
+
+ public TransactionDataNotColocatedException(String s) {
+ super(s);
+ }
+
+ public TransactionDataNotColocatedException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionDataRebalancedException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionDataRebalancedException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionDataRebalancedException.java
new file mode 100644
index 0000000..f10ffcd
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionDataRebalancedException.java
@@ -0,0 +1,29 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+import com.gemstone.gemfire.cache.control.RebalanceOperation;
+
+/**
+ * Thrown when a {@link RebalanceOperation} occurs concurrently with a transaction.
+ * This can be thrown while doing transactional operations or during commit.
+ *
+ * <p>This exception only occurs when a transaction
+ * involves partitioned regions.
+ *
+ * @author gregp
+ * @since 6.6
+ */
+public class TransactionDataRebalancedException extends TransactionException {
+
+ private static final long serialVersionUID = -2217135580436381984L;
+
+ public TransactionDataRebalancedException(String s) {
+ super(s);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionEvent.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionEvent.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionEvent.java
new file mode 100644
index 0000000..8b93005
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionEvent.java
@@ -0,0 +1,105 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire.cache;
+import java.util.*;
+
+/**
+ * <p>An event that describes the culmination of an entire transaction.
+ * It either describes the work done by a committed transaction
+ * or the work abandoned by an explicit rollback or failed commit.
+ * The actual work is represented by an ordered list of {@link EntryEvent}
+ * instances.
+ *
+ * <p>A <code>TransactionListener</code> receives an instance of this
+ * class allowing exploration of the resultant operations. The
+ * resultant operation is the final result of, potentially, a sequence
+ * of operations on a key such that earlier operations might be
+ * masked. For example, multiple put operations using the same key
+ * will result in only one {@link EntryEvent} for that key.
+ *
+ * <p>An instance of TransactionEvent for the same transaction on
+ * the originating VM may differ from a recipient VM. The amount of
+ * variation will depend on the variation of the state of Entries on
+ * each VM. One reason for why this might occur is the different
+ * Expiration/Eviction settings of the similar Regions on different
+ * VMs.
+ *
+ * <p>The event lists are ordered according to the chronological order of
+ * the indiviual operations.
+ *
+ * <p>The {@link EntryEvent} instances always return <code>null</code>
+ * as their {@link CacheEvent#getCallbackArgument callback argument}.
+ *
+ * @author Mitch Thomas
+ *
+ * @see TransactionListener
+ * @see EntryEvent
+ * @since 4.0
+ */
+public interface TransactionEvent {
+
+ /** Gets the <code>TransactionId</code> associated this TransactionEvent.
+ *
+ */
+ public TransactionId getTransactionId();
+
+ /** Gets all "create" EntryEvents for this transaction;
+ * <code>Region.create</code> and/or <code>Region.put</code>
+ *
+ * @return <code>List</code> of <code>EntryEvents</code> or <code>Collections.EMPTY_LIST</code>
+ * @deprecated as of GemFire 5.0, use {@link #getEvents} instead
+ */
+ @Deprecated
+ public List<EntryEvent<?,?>> getCreateEvents();
+
+ /** Gets all "destroy" EntryEvents for this
+ * transaction; <code>Region.destroy</code> and
+ * <code>Region.localDestroy</code>.
+ *
+ * @return <code>List</code> of <code>EntryEvents</code> or <code>Collections.EMPTY_LIST</code>
+ * @deprecated as of GemFire 5.0, use {@link #getEvents} instead
+ */
+ @Deprecated
+ public List<EntryEvent<?,?>> getDestroyEvents();
+
+ /** Gets all <code>Region.put</code> EntryEvents for this transaction.
+ *
+ * @return <code>List</code> of <code>EntryEvents</code> or <code>Collections.EMPTY_LIST</code>
+ * @deprecated as of GemFire 5.0, use {@link #getEvents} instead
+ */
+ @Deprecated
+ public List<EntryEvent<?,?>> getPutEvents();
+
+ /** Gets all "invalidate" EntryEvents for this transaction;
+ * <code>Region.invalidate</code> and
+ * <code>Region.localInvalidate</code>.
+ *
+ * @return <code>List</code> of <code>EntryEvents</code> or <code>Collections.EMPTY_LIST</code>
+ * @deprecated as of GemFire 5.0, use {@link #getEvents} instead
+ */
+ @Deprecated
+ public List<EntryEvent<?,?>> getInvalidateEvents();
+
+ /**
+ * Returns an ordered list of every {@link CacheEvent} for this transaction.
+ * The event order is consistent with the order in which the operations were
+ * performed during the transaction.
+ * @return an unmodifiable <code>List</code> of all the {@link CacheEvent} instances;
+ * one for each operation performed by this transaction.
+ * @since 5.0
+ */
+ public List<CacheEvent<?,?>> getEvents();
+
+ /** Gets the Cache for this transaction event
+ *
+ * @return <code>Cache</code>
+ */
+ public Cache getCache();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionException.java
new file mode 100644
index 0000000..b1c96e7
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionException.java
@@ -0,0 +1,34 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+/**
+ * This is the superclass for all Exceptions that may be thrown
+ * by a GemFire transaction.
+ * @author sbawaska
+ * @since 6.5
+ */
+public class TransactionException extends CacheException {
+
+ private static final long serialVersionUID = -8400774340264221993L;
+
+ public TransactionException() {
+ }
+
+ public TransactionException(String message) {
+ super(message);
+ }
+
+ public TransactionException(Throwable cause) {
+ super(cause);
+ }
+
+ public TransactionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionId.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionId.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionId.java
new file mode 100644
index 0000000..85cc607
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionId.java
@@ -0,0 +1,24 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire.cache;
+
+import java.io.Externalizable;
+
+/** The TransactionId interface is a "marker" interface that
+ * represents a unique GemFire transaction.
+ *
+ * @author Mitch Thomas
+ *
+ * @since 4.0
+ *
+ * @see Cache#getCacheTransactionManager
+ * @see CacheTransactionManager#getTransactionId
+ */
+public interface TransactionId extends Externalizable {
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionInDoubtException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionInDoubtException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionInDoubtException.java
new file mode 100644
index 0000000..f4bfc0e
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionInDoubtException.java
@@ -0,0 +1,33 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+/**
+ * This Exception is thrown in presence of node failures, when GemFire cannot
+ * know with certainty about the outcome of the transaction.
+ * @author sbawaska
+ * @since 6.5
+ */
+public class TransactionInDoubtException extends TransactionException {
+ private static final long serialVersionUID = 4895453685211922512L;
+
+ public TransactionInDoubtException() {
+ }
+
+ public TransactionInDoubtException(String message) {
+ super(message);
+ }
+
+ public TransactionInDoubtException(Throwable cause) {
+ super(cause);
+ }
+
+ public TransactionInDoubtException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionListener.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionListener.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionListener.java
new file mode 100644
index 0000000..1184701
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionListener.java
@@ -0,0 +1,57 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire.cache;
+
+/**
+ * <p>A listener that can be implemented to handle transaction related
+ * events. The methods on <code>TransactionListener</code> are
+ * invoked synchronously after the operation, commit or rollback,
+ * completes. The transaction that causes the listener to be called
+ * will no longer exist at the time the listener code executes. The
+ * thread that performed the transaction operation will not see that
+ * operation complete until the listener method completes its
+ * execution.
+ *
+ * <p>Multiple transactions, on the same cache, can cause concurrent
+ * invocation of <code>TransactionListener</code> methods. Any
+ * exceptions thrown by the listener are caught and logged.
+ *
+ * <p>Rollback and failed commit operations are local.
+ *
+ * @author Darrel Schneider
+ *
+ * @see CacheTransactionManager#setListener
+ * @see CacheTransactionManager#getListener
+ * @since 4.0
+ */
+
+public interface TransactionListener extends CacheCallback {
+
+ /** Called after a successful commit of a transaction.
+ *
+ * @param event the TransactionEvent
+ * @see CacheTransactionManager#commit
+ */
+ public void afterCommit(TransactionEvent event);
+
+ /** Called after an unsuccessful commit operation.
+ *
+ * @param event the TransactionEvent
+ * @see CacheTransactionManager#commit
+ */
+ public void afterFailedCommit(TransactionEvent event);
+
+ /** Called after an explicit rollback of a transaction.
+ *
+ * @param event the TransactionEvent
+ * @see CacheTransactionManager#rollback
+ * @see CacheTransactionManager#commit
+ */
+ public void afterRollback(TransactionEvent event);
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionWriter.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionWriter.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionWriter.java
new file mode 100755
index 0000000..9ca6097
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionWriter.java
@@ -0,0 +1,35 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire.cache;
+
+
+/**
+ * A callback that is allowed to veto a transaction. Only one TransactionWriter can exist
+ * per cache, and only one TransactionWriter will be fired in the
+ * entire distributed system for each transaction.
+ *
+ * This writer can be used to update a backend data source before the GemFire cache is updated during commit.
+ * If the backend update fails, the implementer can throw a {@link TransactionWriterException} to veto the transaction.
+ * @see CacheTransactionManager#setWriter
+ * @since 6.5
+ */
+
+public interface TransactionWriter extends CacheCallback {
+
+ /** Called before the transaction has finished committing, but after conflict checking.
+ * Provides an opportunity for implementors to cause transaction abort by throwing a
+ * TransactionWriterException
+ *
+ * @param event the TransactionEvent
+ * @see CacheTransactionManager#commit
+ * @throws TransactionWriterException in the event that the transaction should be rolled back
+ */
+ public void beforeCommit(TransactionEvent event) throws TransactionWriterException;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionWriterException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionWriterException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionWriterException.java
new file mode 100755
index 0000000..a0793f3
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/TransactionWriterException.java
@@ -0,0 +1,36 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire.cache;
+
+
+
+/**
+ * Exception thrown by implementors of {@link TransactionWriter#beforeCommit} to
+ * signal that the current transaction should be aborted.
+ *
+ * @see TransactionWriter#beforeCommit
+ * @author gregp
+ * @since 6.5
+ *
+ */
+public class TransactionWriterException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5557392877576634835L;
+
+ public TransactionWriterException(String s) {
+ super(s);
+ }
+
+ public TransactionWriterException(Throwable t) {
+ super(t);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/UnsupportedOperationInTransactionException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/UnsupportedOperationInTransactionException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/UnsupportedOperationInTransactionException.java
new file mode 100755
index 0000000..3ccab66
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/UnsupportedOperationInTransactionException.java
@@ -0,0 +1,28 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+/**
+ * Indicates that an attempt was mode to invoke an operation that is not
+ * allowed in a transaction.
+ *
+ * @author gregp
+ * @since 6.5
+ */
+public class UnsupportedOperationInTransactionException extends
+ UnsupportedOperationException {
+
+ public UnsupportedOperationInTransactionException(String s) {
+ super(s);
+ }
+
+ public UnsupportedOperationInTransactionException() {
+ super();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/UnsupportedVersionException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/UnsupportedVersionException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/UnsupportedVersionException.java
new file mode 100755
index 0000000..721d053
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/UnsupportedVersionException.java
@@ -0,0 +1,35 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+/**
+ * An <code>UnsupportedVersionException</code> indicates an unsupported version.
+ *
+ * @since 5.7
+ */
+public class UnsupportedVersionException extends VersionException {
+private static final long serialVersionUID = 1152280300663399399L;
+
+ /**
+ * Constructs a new <code>UnsupportedVersionException</code>.
+ *
+ * @param versionOrdinal The ordinal of the requested <code>Version</code>
+ */
+ public UnsupportedVersionException(short versionOrdinal) {
+ super(String.valueOf(versionOrdinal));
+ }
+
+ /**
+ * Constructs a new <code>UnsupportedVersionException</code>.
+ *
+ * @param message The exception message
+ */
+ public UnsupportedVersionException(String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/VersionException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/VersionException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/VersionException.java
new file mode 100755
index 0000000..9552aa2
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/VersionException.java
@@ -0,0 +1,41 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+package com.gemstone.gemfire.cache;
+
+import com.gemstone.gemfire.GemFireCheckedException;
+
+/**
+ * An <code>VersionException</code> is an exception that indicates
+ * a client / server version mismatch exception has occurred.
+ *
+ * @since 5.7
+ */
+public abstract class VersionException extends GemFireCheckedException {
+
+ /** Constructs a new <code>VersionException</code>. */
+ public VersionException() {
+ super();
+ }
+
+ /** Constructs a new <code>VersionException</code> with a message string. */
+ public VersionException(String s) {
+ super(s);
+ }
+
+ /** Constructs a <code>VersionException</code> with a message string and
+ * a base exception
+ */
+ public VersionException(String s, Throwable cause) {
+ super(s, cause);
+ }
+
+ /** Constructs a <code>VersionException</code> with a cause */
+ public VersionException(Throwable cause) {
+ super(cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEvent.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEvent.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEvent.java
new file mode 100644
index 0000000..b8e0020
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEvent.java
@@ -0,0 +1,33 @@
+/* =========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ * ========================================================================
+ */
+package com.gemstone.gemfire.cache.asyncqueue;
+
+import com.gemstone.gemfire.cache.wan.EventSequenceID;
+import com.gemstone.gemfire.cache.wan.GatewayQueueEvent;
+
+/**
+ * Represents <code>Cache</code> events delivered to <code>AsyncEventListener</code>.
+ *
+ * @author pdeole
+ * @since 7.0
+ */
+public interface AsyncEvent<K, V> extends GatewayQueueEvent<K, V>{
+ /**
+ * Returns whether possibleDuplicate is set for this event.
+ */
+ public boolean getPossibleDuplicate();
+
+ /**
+ * Returns the wrapper over the DistributedMembershipID, ThreadID, SequenceID
+ * which are used to uniquely identify any region operation like create, update etc.
+ * This helps in sequencing the events belonging to a unique producer.
+ * e.g. The EventID can be used to track events received by <code>AsyncEventListener</code>
+ * to avoid processing duplicates.
+ */
+ public EventSequenceID getEventSequenceID();
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventListener.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventListener.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventListener.java
new file mode 100644
index 0000000..b15be28
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventListener.java
@@ -0,0 +1,67 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014, Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+package com.gemstone.gemfire.cache.asyncqueue;
+
+import java.util.List;
+
+import com.gemstone.gemfire.cache.CacheCallback;
+
+/**
+ * A callback for events passing through the <code>AsyncEventQueue</code> to which this
+ * listener is attached. Implementers of interface <code>AsyncEventListener</code> process
+ * batches of <code>AsyncEvent</code> delivered by the corresponding <code>AsyncEventQueue</code>.
+ * <br>
+ * A sample implementation of this interface is as follows: <br>
+ *
+ * <pre>
+ * public class MyEventListener implements AsyncEventListener {
+ *
+ * public boolean processEvents(List<AsyncEvent> events) {
+ * for (Iterator i = events.iterator(); i.hasNext();) {
+ * AsyncEvent event = (AsyncEvent)i.next();
+ *
+ * String originalRegionName = event.getRegion().getName();
+ * //For illustration purpose, use the event to update the duplicate of above region.
+ * final Region duplicateRegion = CacheHelper.getCache().getRegion(originalRegionName + "_DUP");
+ *
+ * final Object key = event.getKey();
+ * final Object value = event.getDeserializedValue();
+ * final Operation op = event.getOperation();
+ *
+ * if (op.isCreate()) {
+ * duplicateRegion.create(key, value);
+ * } else if (op.isUpdate()) {
+ * duplicateRegion.put(key, value);
+ * } else if (op.isDestroy()) {
+ * duplicateRegion.destroy(key);
+ * }
+ *
+ * }
+ * }
+ * }
+ * </pre>
+ *
+ * @author pdeole
+ * @since 7.0
+ */
+public interface AsyncEventListener extends CacheCallback {
+
+ /**
+ * Process the list of <code>AsyncEvent</code>s. This method will
+ * asynchronously be called when events are queued to be processed.
+ * The size of the list will be up to batch size events where batch
+ * size is defined in the <code>AsyncEventQueueFactory</code>.
+ *
+ * @param events The list of <code>AsyncEvent</code> to process
+ *
+ * @return boolean True represents whether the events were successfully processed,
+ * false otherwise.
+ */
+ public boolean processEvents(List<AsyncEvent> events);
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueue.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueue.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueue.java
new file mode 100644
index 0000000..cadb0ca
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueue.java
@@ -0,0 +1,142 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire.cache.asyncqueue;
+
+import java.util.List;
+
+import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
+import com.gemstone.gemfire.cache.wan.GatewayEventSubstitutionFilter;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+
+/**
+ * Interface of AsyncEventQueue.
+ * This represents the channel over which the events are delivered to the <code>AsyncEventListener</code>.
+ *
+ * @author pdeole
+ * @since 7.0
+ */
+public interface AsyncEventQueue {
+
+ /**
+ * @return String Id of the AsyncEventQueue
+ */
+ public String getId();
+
+ /**
+ * The Disk store that is required for overflow and persistence
+ * @return String
+ */
+ public String getDiskStoreName();//for overflow and persistence
+
+ /**
+ * The maximum memory after which the data needs to be overflowed to disk.
+ * Default is 100 MB.
+ * @return int
+ */
+ public int getMaximumQueueMemory();//for overflow
+
+ /**
+ * Represents the size of a batch that gets delivered over the AsyncEventQueue.
+ * Default batchSize is 100.
+ * @return int
+ */
+ public int getBatchSize();
+
+ /**
+ * Represents the maximum time interval that can elapse before a batch is sent
+ * from <code>AsyncEventQueue</code>.
+ * Default batchTimeInterval is 5 ms.
+ *
+ * @return int
+ */
+ public int getBatchTimeInterval();
+
+ /**
+ * Represents whether batch conflation is enabled for batches sent
+ * from <code>AsyncEventQueue</code>.
+ * Default is false.
+ * @return boolean
+ */
+ public boolean isBatchConflationEnabled();
+
+ /**
+ * Represents whether the AsyncEventQueue is configured to be persistent or non-persistent.
+ * Default is false.
+ * @return boolean
+ */
+ public boolean isPersistent();
+
+ /**
+ * Represents whether writing to disk is synchronous or not.
+ * Default is true.
+ * @return boolean
+ */
+ public boolean isDiskSynchronous();
+
+ /**
+ * Represents whether the queue is primary or secondary.
+ * Events get delivered only by the primary queue.
+ * If the primary queue goes down then the secondary queue first becomes primary
+ * and then starts delivering the events.
+ * @return boolean
+ */
+ public boolean isPrimary();
+
+ /**
+ * The <code>AsyncEventListener</code> that is attached to the queue.
+ * All the event passing over the queue are delivered to attached listener.
+ * @return AsyncEventListener Implementation of AsyncEventListener
+ */
+ public AsyncEventListener getAsyncEventListener();
+
+ /**
+ * Represents whether this queue is parallel (higher throughput) or serial.
+ * @return boolean True if the queue is parallel, false otherwise.
+ */
+ public boolean isParallel();
+
+ /**
+ * Returns the number of dispatcher threads working for this <code>AsyncEventQueue</code>.
+ * Default number of dispatcher threads is 5.
+ *
+ * @return the number of dispatcher threads working for this <code>AsyncEventQueue</code>
+ */
+ public int getDispatcherThreads();
+
+ /**
+ * Returns the order policy followed while dispatching the events to AsyncEventListener.
+ * Order policy is set only when dispatcher threads are > 1.
+ * Default order policy is KEY.
+ * @return the order policy followed while dispatching the events to AsyncEventListener.
+ */
+ public OrderPolicy getOrderPolicy();
+
+ /**
+ * Returns the number of entries in this <code>AsyncEventQueue</code>.
+ * @return the number of entries in this <code>AsyncEventQueue</code>.
+ */
+ public int size();
+
+ /**
+ * Returns the <code>GatewayEventFilters</code> for this
+ * <code>AsyncEventQueue</code>
+ *
+ * @return the <code>GatewayEventFilters</code> for this
+ * <code>AsyncEventQueue</code>
+ */
+ public List<GatewayEventFilter> getGatewayEventFilters();
+
+ /**
+ * Returns the <code>GatewayEventSubstitutionFilter</code> for this
+ * <code>AsyncEventQueue</code>
+ *
+ * @return the <code>GatewayEventSubstitutionFilter</code> for this
+ * <code>AsyncEventQueue</code>
+ */
+ public GatewayEventSubstitutionFilter getGatewayEventSubstitutionFilter();
+}