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:28 UTC

[23/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/EvictionAttributes.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/EvictionAttributes.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/EvictionAttributes.java
new file mode 100644
index 0000000..04a70aa
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/EvictionAttributes.java
@@ -0,0 +1,486 @@
+/*
+ * =========================================================================
+ * 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 com.gemstone.gemfire.cache.control.ResourceManager;
+import com.gemstone.gemfire.cache.util.ObjectSizer;
+import com.gemstone.gemfire.internal.cache.EvictionAttributesImpl;
+
+/**
+ * <p>Attributes that describe how a <code>Region</code>'s size is managed through an eviction controller. Eviction
+ * controllers are defined by an {@link com.gemstone.gemfire.cache.EvictionAlgorithm} and a {@link
+ * com.gemstone.gemfire.cache.EvictionAction}. Once a <code>Region</code> is created with an eviction controller, it can
+ * not be removed, however it can be changed through an {@link com.gemstone.gemfire.cache.EvictionAttributesMutator}.
+ *
+ * @author Mitch Thomas
+ * @see com.gemstone.gemfire.cache.AttributesFactory#setEvictionAttributes(EvictionAttributes)
+ * @see com.gemstone.gemfire.cache.AttributesMutator
+ * @since 5.0
+ */
+@SuppressWarnings("serial")
+public abstract class EvictionAttributes implements DataSerializable {
+  /**
+   * The default maximum for {@linkplain EvictionAlgorithm#LRU_ENTRY entry LRU}. Currently <code>900</code> entries.
+   */
+  public static final int DEFAULT_ENTRIES_MAXIMUM = 900;
+  /**
+   * The default maximum for {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU}. Currently <code>10</code> megabytes.
+   */
+  public static final int DEFAULT_MEMORY_MAXIMUM = 10;
+
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_ENTRY entry LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action}
+   * and default {@linkplain #DEFAULT_ENTRIES_MAXIMUM maximum}. 
+   * <p/>
+   * {@link EvictionAttributes} cause regions to evict the least recently used (LRU)
+   * entry once the region reaches a maximum capacity. The entry is either locally destroyed or its value overflows
+   * to disk when evicted.
+   * <p/>
+   * <p/>
+   * This is not supported when replication is enabled.
+   * <p/>
+   * <p/>
+   * For a region with {@link DataPolicy#PARTITION}, the EvictionAttribute <code>maximum</code>, indicates the number of
+   * entries allowed in the region, collectively for its primary buckets and redundant copies for this JVM. Once there
+   * are <code>maximum</code> entries in the region's primary buckets and redundant copies for this JVM, the least
+   * recently used entry will be evicted from the bucket in which the subsequent put takes place.
+   * <p/>
+   * <p/>
+   * If you are using a <code>cache.xml</code> file to create a Cache Region declaratively, you can include the
+   * following to configure a region for eviction
+   * <p/>
+   * <pre>
+   *         &lt;region-attributes&gt;
+   *            &lt;eviction-attributes&gt;
+   *               &lt;lru-entry-count maximum=&quot;900&quot; action=&quot;local-destroy&quot;/&gt;
+   *            &lt;/eviction-attributes&gt;
+   *         &lt;/region-attributes&gt;
+   * </pre>
+   *
+   * @return {@linkplain EvictionAlgorithm#LRU_ENTRY entry LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action}
+   * and default {@linkplain #DEFAULT_ENTRIES_MAXIMUM maximum}
+   */
+  public static EvictionAttributes createLRUEntryAttributes() {
+    return new EvictionAttributesImpl().setAlgorithm(
+      EvictionAlgorithm.LRU_ENTRY).setAction(
+      EvictionAction.DEFAULT_EVICTION_ACTION).internalSetMaximum(
+      DEFAULT_ENTRIES_MAXIMUM);
+  }
+
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_ENTRY entry LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action}
+   * and given <code>maximumEntries</code>.
+   *
+   * @param maximumEntries the number of entries to keep in the Region
+   * @return {@linkplain EvictionAlgorithm#LRU_ENTRY entry LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action}
+   * and <code>maximumEntries</code>
+   * @see #createLRUEntryAttributes()
+   */
+  public static EvictionAttributes createLRUEntryAttributes(int maximumEntries) {
+    return new EvictionAttributesImpl().setAlgorithm(EvictionAlgorithm.LRU_ENTRY).setAction(
+      EvictionAction.DEFAULT_EVICTION_ACTION).internalSetMaximum(maximumEntries);
+  }
+  
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_ENTRY entry LRU} eviction attributes
+   * with default {@linkplain #DEFAULT_ENTRIES_MAXIMUM maximum}
+   * and given <code>evictionAction</code>.
+   *
+   * @param evictionAction the action to perform when evicting an entry
+   * @return {@linkplain EvictionAlgorithm#LRU_ENTRY entry LRU} eviction attributes
+   * with default {@linkplain #DEFAULT_ENTRIES_MAXIMUM maximum}
+   * and given <code>evictionAction</code>
+   * @see #createLRUEntryAttributes()
+   * @since 8.1
+   */
+  public static EvictionAttributes createLRUEntryAttributes(EvictionAction evictionAction) {
+    return new EvictionAttributesImpl().setAlgorithm(EvictionAlgorithm.LRU_ENTRY).setAction(evictionAction)
+      .internalSetMaximum(DEFAULT_ENTRIES_MAXIMUM);
+  }
+
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_ENTRY entry LRU} eviction attributes
+   * with given <code>evictionAction</code>
+   * and given <code>maximumEntries</code>.
+   *
+   * @param maximumEntries the number of entries to keep in the Region
+   * @param evictionAction the action to perform when evicting an entry
+   * @return {@linkplain EvictionAlgorithm#LRU_ENTRY entry LRU} eviction attributes
+   * with given <code>evictionAction</code>
+   * and given <code>maximumEntries</code>
+   * @see #createLRUEntryAttributes()
+   */
+  public static EvictionAttributes createLRUEntryAttributes(int maximumEntries, EvictionAction evictionAction) {
+    return new EvictionAttributesImpl().setAlgorithm(EvictionAlgorithm.LRU_ENTRY).setAction(evictionAction)
+      .internalSetMaximum(maximumEntries);
+  }
+
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_HEAP heap LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action}
+   * and default {@linkplain ObjectSizer#DEFAULT sizer}.
+   * <p/>
+   * Heap LRU EvictionAttributes evict the least recently used {@link Region.Entry} when heap usage exceeds the
+   * {@link ResourceManager} eviction heap threshold. If the eviction heap threshold is exceeded the least recently used
+   * {@link Region.Entry}s are evicted.
+   * <p/>
+   * <p/>
+   * With other LRU-based eviction controllers, only cache actions (such as {@link Region#put(Object, Object) puts} and
+   * {@link Region#get(Object) gets}) cause the LRU entry to be evicted. However, with heap LRU, because the JVM's heap may be effected
+   * by more than just the GemFire cache operations, a daemon thread will perform the eviction if no operations are being done
+   * on the region.
+   * <p/>
+   * The eviction attribute's {@linkplain ObjectSizer sizer} is used to estimate how much the heap will be reduced by an
+   * eviction. 
+   * <p/>
+   * When using Heap LRU, the JVM must be launched with the <code>-Xmx</code> and <code>-Xms</code> switches set to the
+   * same values. Many virtual machine implementations have additional JVM switches to control the behavior of the
+   * garbage collector. We suggest that you investigate tuning the garbage collector when using this type of eviction
+   * controller.  A collector that frequently collects is needed to keep our heap usage up to date. In particular, on
+   * the Sun <A href="http://java.sun.com/docs/hotspot/gc/index.html">HotSpot</a> JVM, the
+   * <code>-XX:+UseConcMarkSweepGC</code> flag needs to be set, and <code>-XX:CMSInitiatingOccupancyFraction=N</code>
+   * should be set with N being a percentage that is less than the {@link ResourceManager} eviction heap threshold.
+   * <p/>
+   * The JRockit JVM has similar flags, <code>-Xgc:gencon</code> and <code>-XXgcTrigger:N</code>, which are required if
+   * using this LRU algorithm. Please Note: the JRockit gcTrigger flag is based on heap free, not heap in use like the
+   * GemFire parameter. This means you need to set gcTrigger to 100-N. for example, if your eviction threshold is 30
+   * percent, you will need to set gcTrigger to 70 percent.
+   * <p/>
+   * On the IBM JVM, the flag to get a similar collector is <code>-Xgcpolicy:gencon</code>, but there is no corollary to
+   * the gcTrigger/CMSInitiatingOccupancyFraction flags, so when using this feature with an IBM JVM, the heap usage
+   * statistics might lag the true memory usage of the JVM, and thresholds may need to be set sufficiently high that the
+   * JVM will initiate GC before the thresholds are crossed.
+   * <p/>
+   * If you are using a <code>cache.xml</code> file to create a Cache Region declaratively, you can include the
+   * following to create an LRU heap eviction controller:
+   * <p/>
+   * <pre>
+   *         &lt;region-attributes&gt;
+   *            &lt;eviction-attributes&gt;
+   *               &lt;lru-heap-percentage action=&quot;local-destroy&quot;
+   *            &lt;/eviction-attributes&gt;
+   *         &lt;/region-attributes&gt;
+   * </pre>
+   * <p/>
+   *
+   * @return {@linkplain EvictionAlgorithm#LRU_HEAP heap LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action}
+   * and default {@linkplain ObjectSizer#DEFAULT sizer}
+   */
+  public static EvictionAttributes createLRUHeapAttributes() {
+    return new EvictionAttributesImpl()
+      .setAlgorithm(EvictionAlgorithm.LRU_HEAP)
+      .setAction(EvictionAction.DEFAULT_EVICTION_ACTION)
+      .setObjectSizer(ObjectSizer.DEFAULT);
+  }
+
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_HEAP heap LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action}
+   * and the given <code>sizer</code>.
+   *
+   * @param sizer the sizer implementation used to determine the size of each entry in this region
+   * @return {@linkplain EvictionAlgorithm#LRU_HEAP heap LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action}
+   * and the given <code>sizer</code>
+   * @see #createLRUHeapAttributes()
+   */
+  public static EvictionAttributes createLRUHeapAttributes(final ObjectSizer sizer) {
+    return new EvictionAttributesImpl()
+      .setAlgorithm(EvictionAlgorithm.LRU_HEAP)
+      .setAction(EvictionAction.DEFAULT_EVICTION_ACTION)
+      .setObjectSizer(sizer);
+  }
+
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_HEAP heap LRU} eviction attributes
+   * with the given <code>evictionAction</code>
+   * and given <code>sizer</code>.
+   *
+   * @param sizer the sizer implementation used to determine the size of each entry in this region
+   * @param evictionAction the way in which entries should be evicted
+   * @return {@linkplain EvictionAlgorithm#LRU_HEAP heap LRU} eviction attributes
+   * with the given <code>evictionAction</code>
+   * and given <code>sizer</code>
+   * @see #createLRUHeapAttributes()
+   */
+  public static EvictionAttributes createLRUHeapAttributes(final ObjectSizer sizer, final EvictionAction evictionAction) {
+    return new EvictionAttributesImpl()
+      .setAlgorithm(EvictionAlgorithm.LRU_HEAP)
+      .setAction(evictionAction)
+      .setObjectSizer(sizer);
+  }
+
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action},
+   * default {@linkplain ObjectSizer#DEFAULT sizer},
+   * and default {@linkplain #DEFAULT_MEMORY_MAXIMUM maximum}. 
+   * <p/>
+   * Creates EvictionAttributes for an eviction controller that will remove the least recently used (LRU) entry from a
+   * region once the region reaches a certain byte capacity. Capacity is determined by monitoring the size of entries
+   * added and evicted. Capacity is specified in terms of megabytes. GemFire uses an efficient algorithm to determine
+   * the amount of space a region entry occupies in the JVM. However, this algorithm may not yield optimal results for
+   * all kinds of data. The user may provide his or her own algorithm for determining the size of objects by
+   * implementing an {@link ObjectSizer}.
+   * <p/>
+   * <p/>
+   * For a region with {@link DataPolicy#PARTITION}, the EvictionAttribute <code>maximum</code>, is always equal to
+   * {@link  PartitionAttributesFactory#setLocalMaxMemory(int)  " local max memory "} specified for the {@link
+   * PartitionAttributes}. It signifies the amount of memory allowed in the region, collectively for its primary buckets
+   * and redundant copies for this JVM. It can be different for the same region in different JVMs.
+   * <p/>
+   * If you are using a <code>cache.xml</code> file to create a Cache Region declaratively, you can include the
+   * following to create an LRU memory eviction controller:
+   * <p/>
+   * <pre>
+   *          &lt;region-attributes&gt;
+   *            &lt;eviction-attributes&gt;
+   *               &lt;lru-memory-size maximum=&quot;10&quot; action=&quot;local-destroy&quot;&gt;
+   *                  &lt;class-name&gt;com.foo.MySizer&lt;/class-name&gt;
+   *                  &lt;parameter name=&quot;name&quot;&gt;
+   *                     &lt;string&gt;Super Sizer&lt;/string&gt;
+   *                  &lt;/parameter&gt;
+   *               &lt;/lru-memory-size&gt;
+   *            &lt;/eviction-attributes&gt;
+   *         &lt;/region-attributes&gt;
+   * </pre>
+   *
+   * @return {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action},
+   * default {@linkplain ObjectSizer#DEFAULT sizer},
+   * and default {@linkplain #DEFAULT_MEMORY_MAXIMUM maximum}
+   */
+  public static EvictionAttributes createLRUMemoryAttributes() {
+    return new EvictionAttributesImpl().setAlgorithm(EvictionAlgorithm.LRU_MEMORY).setAction(
+      EvictionAction.DEFAULT_EVICTION_ACTION).internalSetMaximum(DEFAULT_MEMORY_MAXIMUM)
+        .setObjectSizer(ObjectSizer.DEFAULT);
+  }
+
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action},
+   * default {@linkplain ObjectSizer#DEFAULT sizer},
+   * and given <code>maximumMegabytes</code>.
+   * <p/>
+   * <p/>
+   * For a region with {@link DataPolicy#PARTITION}, even if maximumMegabytes are supplied, the EvictionAttribute
+   * <code>maximum</code>, is always set to {@link PartitionAttributesFactory#setLocalMaxMemory(int) " local max memory
+   * "} specified for the {@link PartitionAttributes}.
+   * <p/>
+   *
+   * @param maximumMegabytes the maximum allowed bytes in the Region
+   * @return {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action},
+   * default {@linkplain ObjectSizer#DEFAULT sizer},
+   * and given <code>maximumMegabytes</code>
+   * @see #createLRUMemoryAttributes()
+   */
+  public static EvictionAttributes createLRUMemoryAttributes(int maximumMegabytes) {
+    return new EvictionAttributesImpl().setAlgorithm(EvictionAlgorithm.LRU_MEMORY).setAction(
+      EvictionAction.DEFAULT_EVICTION_ACTION).internalSetMaximum(maximumMegabytes).setObjectSizer(null);
+  }
+
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action},
+   * given <code>sizer</code>,
+   * and given <code>maximumMegabytes</code>.
+   * <p/>
+   * <p>For a region with {@link DataPolicy#PARTITION}, even if maximumMegabytes are supplied, the EvictionAttribute
+   * <code>maximum</code>, is always set to {@link  PartitionAttributesFactory#setLocalMaxMemory(int)  " local max
+   * memory "} specified for the {@link PartitionAttributes}.
+   *
+   * @param maximumMegabytes the maximum allowed bytes in the Region
+   * @param sizer calculates the size in bytes of the key and value for an entry.
+   * @return {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action},
+   * given <code>sizer</code>,
+   * and given <code>maximumMegabytes</code>
+   * @see #createLRUMemoryAttributes()
+   */
+  public static EvictionAttributes createLRUMemoryAttributes(int maximumMegabytes, ObjectSizer sizer) {
+    return new EvictionAttributesImpl().setAlgorithm(EvictionAlgorithm.LRU_MEMORY).setAction(
+      EvictionAction.DEFAULT_EVICTION_ACTION).internalSetMaximum(maximumMegabytes).setObjectSizer(sizer);
+  }
+
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU} eviction attributes
+   * with the given <code>evictionAction</code>,
+   * given <code>sizer</code>,
+   * and given <code>maximumMegabytes</code>.
+   * <p/>
+   * <p>For a region with {@link DataPolicy#PARTITION}, even if maximumMegabytes are supplied, the EvictionAttribute
+   * <code>maximum</code>, is always set to {@link  PartitionAttributesFactory#setLocalMaxMemory(int)  " local max
+   * memory "} specified for the {@link PartitionAttributes}.
+   *
+   * @param maximumMegabytes the maximum allowed bytes in the Region
+   * @param sizer calculates the size in bytes of the key and value for an entry.
+   * @param evictionAction the action to take when the maximum has been reached.
+   * @return {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU} eviction attributes
+   * with the given <code>evictionAction</code>,
+   * given <code>sizer</code>,
+   * and given <code>maximumMegabytes</code>
+   * @see #createLRUMemoryAttributes()
+   */
+  public static EvictionAttributes createLRUMemoryAttributes(int maximumMegabytes, ObjectSizer sizer, EvictionAction evictionAction) {
+    return new EvictionAttributesImpl().setAlgorithm(EvictionAlgorithm.LRU_MEMORY).setAction(evictionAction)
+      .internalSetMaximum(maximumMegabytes).setObjectSizer(sizer);
+  }
+
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action},
+   * given <code>sizer</code>,
+   * and default {@linkplain #DEFAULT_MEMORY_MAXIMUM maximum}. 
+   * <p/>
+   * <p>For a region with {@link DataPolicy#PARTITION}, even if maximumMegabytes are supplied, the EvictionAttribute
+   * <code>maximum</code>, is always set to {@link  PartitionAttributesFactory#setLocalMaxMemory(int)  " local max
+   * memory "} specified for the {@link PartitionAttributes}.
+   *
+   * @param sizer calculates the size in bytes of the key and value for an entry.
+   * @return {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU} eviction attributes
+   * with default {@linkplain EvictionAction#DEFAULT_EVICTION_ACTION action},
+   * given <code>sizer</code>,
+   * and default {@linkplain #DEFAULT_MEMORY_MAXIMUM maximum}
+   * @see #createLRUMemoryAttributes()
+   * @since 6.0
+   */
+  public static EvictionAttributes createLRUMemoryAttributes(ObjectSizer sizer) {
+    return new EvictionAttributesImpl().setAlgorithm(EvictionAlgorithm.LRU_MEMORY).setAction(
+      EvictionAction.DEFAULT_EVICTION_ACTION).setObjectSizer(sizer).internalSetMaximum(
+          DEFAULT_MEMORY_MAXIMUM);
+  }
+
+  /**
+   * Creates and returns {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU} eviction attributes
+   * with given <code>evictionAction</code>,
+   * given <code>sizer</code>,
+   * and default {@linkplain #DEFAULT_MEMORY_MAXIMUM maximum}. 
+   * <p/>
+   * <p>For a region with {@link DataPolicy#PARTITION}, even if maximumMegabytes are supplied, the EvictionAttribute
+   * <code>maximum</code>, is always set to {@link  PartitionAttributesFactory#setLocalMaxMemory(int)  " local max
+   * memory "} specified for the {@link PartitionAttributes}.
+   *
+   * @param sizer calculates the size in bytes of the key and value for an entry.
+   * @param evictionAction the action to take when the maximum has been reached.
+   * @return {@linkplain EvictionAlgorithm#LRU_MEMORY memory LRU} eviction attributes
+   * with given <code>evictionAction</code>,
+   * given <code>sizer</code>,
+   * and default {@linkplain #DEFAULT_MEMORY_MAXIMUM maximum}
+   * @see #createLRUMemoryAttributes()
+   * @since 6.0
+   */
+  public static EvictionAttributes createLRUMemoryAttributes(ObjectSizer sizer, EvictionAction evictionAction) {
+    return new EvictionAttributesImpl().setAlgorithm(EvictionAlgorithm.LRU_MEMORY).setAction(evictionAction)
+      .setObjectSizer(sizer).internalSetMaximum(DEFAULT_MEMORY_MAXIMUM);
+  }
+
+  /**
+   * An {@link ObjectSizer} is used by the {@link EvictionAlgorithm#LRU_MEMORY} algorithm to measure the size of each
+   * Entry as it is entered into a Region. A default implementation is provided, see {@link
+   * #createLRUMemoryAttributes()} for more.
+   * An {@link ObjectSizer} is used by {@link EvictionAlgorithm#LRU_HEAP} to estimate how much heap will be saved
+   * when evicting a region entry.
+   *
+   * @return the sizer used by {@link EvictionAlgorithm#LRU_MEMORY} or {@link EvictionAlgorithm#LRU_HEAP}, for all other algorithms null is returned.
+   */
+  public abstract ObjectSizer getObjectSizer();
+
+  /**
+   * The algorithm is used to identify entries that will be evicted.
+   *
+   * @return a non-null EvictionAlgorithm instance reflecting the configured value or NONE when no eviction controller
+   *         has been configured.
+   */
+  public abstract EvictionAlgorithm getAlgorithm();
+
+  /**
+   * The unit of this value is determined by the definition of the {@link EvictionAlgorithm} set by one of the creation
+   * methods e.g. {@link EvictionAttributes#createLRUEntryAttributes()}
+   *
+   * @return maximum value used by the {@link EvictionAlgorithm} which determines when the {@link EvictionAction} is
+   *         performed.
+   */
+  public abstract int getMaximum();
+
+  /** @return action that the {@link EvictionAlgorithm} takes when the maximum value is reached. */
+  public abstract EvictionAction getAction();
+
+  @Override
+  public final boolean equals(final Object obj) {
+    if (obj == this) {
+      return true;
+    }
+    if (!(obj instanceof EvictionAttributes)) {
+      return false;
+    }
+    final EvictionAttributes other = (EvictionAttributes) obj;
+    if (!this.getAlgorithm().equals(other.getAlgorithm()) ||
+        !this.getAction().equals(other.getAction())) {
+      return false;
+    }
+    // LRUHeap doesn't support maximum
+    if (!this.getAlgorithm().isLRUHeap() &&
+        this.getMaximum() != other.getMaximum()) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public final int hashCode() {
+    if (getAlgorithm().isLRUHeap()) {
+      return getAlgorithm().hashCode();
+    } else {
+      return this.getAlgorithm().hashCode() ^ this.getMaximum();
+    }
+  }
+
+  @Override
+  public String toString() {
+    final StringBuilder buffer = new StringBuilder(128);
+    buffer.append(" algorithm=").append(this.getAlgorithm());
+    if (!this.getAlgorithm().isNone()) {
+      buffer.append("; action=").append(this.getAction());
+      if (!getAlgorithm().isLRUHeap()) {
+        buffer.append("; maximum=").append(this.getMaximum());
+      }
+      if (this.getObjectSizer() != null) {
+        buffer.append("; sizer=").append(this.getObjectSizer());
+      }
+    }
+    return buffer.toString();
+  }
+
+  /**
+   * @return an EvictionAttributes for the  LIFOCapacityController
+   * @since 5.7
+   */
+  public static EvictionAttributes createLIFOEntryAttributes(int maximumEntries, EvictionAction evictionAction) {
+    return new EvictionAttributesImpl().setAlgorithm(EvictionAlgorithm.LIFO_ENTRY).setAction(evictionAction)
+      .internalSetMaximum(maximumEntries);
+  }
+
+  /**
+   * @return an EvictionAttributes for the MemLIFOCapacityController
+   * @since 5.7
+   */
+  public static EvictionAttributes createLIFOMemoryAttributes(int maximumMegabytes, EvictionAction evictionAction) {
+    return new EvictionAttributesImpl().setAlgorithm(EvictionAlgorithm.LIFO_MEMORY).setAction(evictionAction)
+      .internalSetMaximum(maximumMegabytes).setObjectSizer(null);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/EvictionAttributesMutator.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/EvictionAttributesMutator.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/EvictionAttributesMutator.java
new file mode 100644
index 0000000..bb0fbfc
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/EvictionAttributesMutator.java
@@ -0,0 +1,31 @@
+package com.gemstone.gemfire.cache;
+/*=========================================================================
+ * 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.
+ *========================================================================
+ */
+
+import com.gemstone.gemfire.internal.cache.EvictionAttributesImpl;
+
+/**
+ * The EvictionAttributesMutator allows changes to be made to a 
+ * {@link com.gemstone.gemfire.cache.EvictionAttributes}. It is returned
+ * by {@link com.gemstone.gemfire.cache.AttributesMutator#getEvictionAttributesMutator()}
+ * @author Mitch Thomas
+ * @since 5.0
+ */
+public interface EvictionAttributesMutator
+{
+  /**
+   * Sets the maximum value on the {@link EvictionAttributesImpl} that the given
+   * {@link EvictionAlgorithm} uses to determine when to perform its
+   * {@link EvictionAction}. The unit of the maximum value is determined by the
+   * {@link EvictionAlgorithm}
+   * 
+   * @param maximum
+   *          value used by the {@link EvictionAlgorithm}
+   */
+  public void setMaximum(int maximum);
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ExpirationAction.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ExpirationAction.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ExpirationAction.java
new file mode 100644
index 0000000..f2245f4
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ExpirationAction.java
@@ -0,0 +1,114 @@
+/*=========================================================================
+ * 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.*;
+
+/**
+ * Enumerated type for expiration actions.
+ *
+ * @author Eric Zoerner
+ *
+ *
+ * @see ExpirationAttributes
+ * @since 3.0
+ */
+public class ExpirationAction implements Serializable {
+    private static final long serialVersionUID = 658925707882047900L;
+    
+    /** When the region or cached object expires, it is invalidated. */
+    public final static ExpirationAction INVALIDATE = new ExpirationAction("INVALIDATE");
+    /** When expired, invalidated locally only. Not supported for partitioned regions. */
+    public final static ExpirationAction LOCAL_INVALIDATE = new ExpirationAction("LOCAL_INVALIDATE");
+    
+    /** When the region or cached object expires, it is destroyed. */
+    public final static ExpirationAction DESTROY = new ExpirationAction("DESTROY");
+    /** When expired, destroyed locally only. Not supported for partitioned regions. Use DESTROY instead. */
+    public final static ExpirationAction LOCAL_DESTROY = new ExpirationAction("LOCAL_DESTROY");
+    
+    /** The name of this action */
+    private final transient String name;
+    
+    /** Creates a new instance of ExpirationAction.
+     * 
+     * @param name the name of the expiration action
+     * @see #toString
+     */
+    private ExpirationAction(String name) {
+        this.name = name;
+    }
+    
+    /**
+     * Returns whether this is the action for distributed invalidate.
+     * @return true if this in INVALIDATE
+     */
+    public boolean isInvalidate() {
+      return this == INVALIDATE;
+    }
+    
+    /**
+     * Returns whether this is the action for local invalidate.
+     * @return true if this is LOCAL_INVALIDATE
+     */
+    public boolean isLocalInvalidate() {
+      return this == LOCAL_INVALIDATE;
+    }
+    
+    /** Returns whether this is the action for distributed destroy.
+     * @return true if this is DESTROY
+     */
+    public boolean isDestroy() {
+      return this == DESTROY;
+    }
+    
+    /** Returns whether this is the action for local destroy.
+     * @return true if thisis LOCAL_DESTROY
+     */
+    public boolean isLocalDestroy() {
+      return this == LOCAL_DESTROY;
+    }
+    
+    /** Returns whether this action is local.
+     * @return true if this is LOCAL_INVALIDATE or LOCAL_DESTROY
+     */
+    public boolean isLocal() {
+      return this == LOCAL_INVALIDATE || this == LOCAL_DESTROY;
+    }
+    
+    /** Returns whether this action is distributed.
+     * @return true if this is INVALIDATE or DESTROY
+     */
+    public boolean isDistributed() {
+      return !isLocal();
+    }    
+        
+    /** Returns a string representation for this action
+     * @return the name of this action
+     */
+    @Override
+    public String toString() {
+        return this.name;
+    }
+
+    // The 4 declarations below are necessary for serialization
+    private static int nextOrdinal = 0;
+    public final int ordinal = nextOrdinal++;
+    private static final ExpirationAction[] VALUES =
+      { INVALIDATE, LOCAL_INVALIDATE, DESTROY, LOCAL_DESTROY};
+    private Object readResolve() throws ObjectStreamException {
+      return fromOrdinal(ordinal);  // Canonicalize
+    }
+
+    /** Return the ExpirationAction represented by specified ordinal */
+    public static ExpirationAction fromOrdinal(int ordinal) {
+      return VALUES[ordinal];
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ExpirationAttributes.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ExpirationAttributes.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ExpirationAttributes.java
new file mode 100644
index 0000000..1b64c70
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/ExpirationAttributes.java
@@ -0,0 +1,135 @@
+/*=========================================================================
+ * 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.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import com.gemstone.gemfire.DataSerializable;
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.internal.InternalDataSerializer;
+
+/** Immutable parameter object for accessing and setting the attributes associated with 
+ * <code>timeToLive</code> and <code>idleTimeout</code>. If the expiration
+ * action is not specified, it defaults to <code>ExpirationAction.INVALIDATE</code>.
+ * If the timeout is not specified, it defaults to zero (which means to never timeout).
+ *
+ * @author Eric Zoerner
+ *
+ *
+ * @see AttributesFactory
+ * @see RegionAttributes
+ * @see AttributesMutator
+ * @since 3.0
+ */
+public class ExpirationAttributes implements DataSerializable { 
+  private static final long serialVersionUID = 5956885652945706394L;
+  /** convenience constant for a default instance */
+  public static final ExpirationAttributes DEFAULT = new ExpirationAttributes();
+  
+  /** The number of seconds since this value or region was created before it expires. */  
+  private  int timeout;
+  
+  /** The action that should take place when this object or region expires.
+   */  
+  private  ExpirationAction action;
+
+  /** Constructs a default <code>ExpirationAttributes</code>, which indicates no expiration
+   * will take place.
+   */
+  public ExpirationAttributes() {
+    this.timeout = 0;
+    this.action = ExpirationAction.INVALIDATE;
+  }
+  
+  /** Constructs an <code>ExpirationAttributes</code> with the specified expiration time
+   * and the default expiration action <code>ExpirationAction.INVALIDATE</code>.
+   * @param expirationTime The number of seconds before expiration
+   * @throws IllegalArgumentException if expirationTime is nonpositive
+   */
+  public ExpirationAttributes(int expirationTime) {
+    this.timeout = expirationTime;
+    this.action = ExpirationAction.INVALIDATE;
+  }
+  
+  /** Constructs an <code>ExpirationAttributes</code> with the specified expiration time and
+   * expiration action.
+   * @param expirationTime The number of seconds for a value to live before it expires
+   * @param expirationAction the action to take when the value expires
+   * @throws IllegalArgumentException if expirationTime is nonpositive
+   */
+  public ExpirationAttributes(int expirationTime, ExpirationAction expirationAction) {
+    this.timeout = expirationTime;
+    this.action = expirationAction;
+  }
+  
+
+  /** Returns the number of seconds before a region or value expires.
+   *
+   * @return the relative number of seconds before a region or value expires
+   * or zero if it will never expire
+   */  
+  public int getTimeout() {
+    return this.timeout;
+  }
+  
+  /** Returns the action that should take place when this value or region expires.
+   * 
+   * @return the action to take when expiring
+   */  
+  public ExpirationAction getAction() {
+    return this.action;
+  }
+  
+  @Override
+  public boolean equals(Object obj) {
+    if (!(obj instanceof ExpirationAttributes)) {
+      return false;
+    }
+    ExpirationAttributes ea = (ExpirationAttributes)obj;
+    return this.timeout == ea.timeout && this.action == ea.action;
+  }
+  
+  @Override
+  public int hashCode() {
+    return this.timeout ^ this.action.hashCode();
+  }
+  
+  /** Returns a string representation of this <code>ExpirationAttributes</code>. If the timeout
+   * is zero, returns <code>"NO EXPIRATION"</code>.
+   * @return the String representation of this expiration attribute
+   */
+  @Override
+  public String toString() {
+    if (this.timeout == 0) {
+      return "NO EXPIRATION";
+    }
+    return "timeout: " + this.timeout +  ";action: " + this.action;
+  }
+  
+  public static ExpirationAttributes createFromData(DataInput in)
+      throws IOException, ClassNotFoundException {
+    ExpirationAttributes result = new ExpirationAttributes();
+    InternalDataSerializer.invokeFromData(result, in);
+    return result;
+  }
+
+
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    this.timeout = in.readInt();
+    this.action = (ExpirationAction)DataSerializer.readObject(in);
+
+  }
+
+  public void toData(DataOutput out) throws IOException {
+    out.writeInt(this.timeout);
+    DataSerializer.writeObject(this.action, out);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/FailedSynchronizationException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/FailedSynchronizationException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/FailedSynchronizationException.java
new file mode 100644
index 0000000..5697e3c
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/FailedSynchronizationException.java
@@ -0,0 +1,46 @@
+/*=========================================================================
+ * 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 cache transaction fails to register with the
+ * <code>UserTransaction</code> (aka JTA transaction), most likely the
+ * cause of the <code>UserTransaction</code>'s
+ * <code>javax.transaction.Status#STATUS_MARKED_ROLLBACK</code>
+ * status.
+ *
+ * @author Mitch Thomas
+ *
+ * @see javax.transaction.UserTransaction#setRollbackOnly
+ * @see javax.transaction.Transaction#registerSynchronization
+ * @see javax.transaction.Status
+ * @since 4.0
+ */
+public class FailedSynchronizationException extends CacheRuntimeException {
+private static final long serialVersionUID = -6225053492344591496L;
+  /**
+   * Constructs an instance of
+   * <code>FailedSynchronizationException</code> with the
+   * specified detail message.
+   * @param msg the detail message
+   */
+  public FailedSynchronizationException(String msg) {
+    super(msg);
+  }
+  
+  /**
+   * Constructs an instance of
+   * <code>FailedSynchronizationException</code> with the
+   * specified detail message and cause.
+   * @param msg the detail message
+   * @param cause the causal Throwable
+   */
+  public FailedSynchronizationException(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/FixedPartitionAttributes.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/FixedPartitionAttributes.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/FixedPartitionAttributes.java
new file mode 100644
index 0000000..25bc41f
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/FixedPartitionAttributes.java
@@ -0,0 +1,106 @@
+/*=========================================================================
+ * 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.internal.cache.FixedPartitionAttributesImpl;
+
+/**
+ * Composite date type used to distribute the attributes for a fixed partition.
+ * </p>
+ * 
+ * {@link com.gemstone.gemfire.cache.PartitionAttributes#getFixedPartitionAttributes()}
+ * returns all fixed partitions in Partitioned Region attributes. </p>
+ * {@link com.gemstone.gemfire.cache.PartitionAttributesFactory#addFixedPartitionAttributes(FixedPartitionAttributes)}
+ * configures <code>FixedPartitionAttributes</Code> in
+ * <code>PartitionedRegionAttributes</code> </p>
+ * 
+ * @see com.gemstone.gemfire.cache.PartitionAttributes
+ * @see com.gemstone.gemfire.cache.PartitionAttributesFactory
+ * 
+ * @author kbachhav
+ * @since 6.6
+ */
+
+public abstract class FixedPartitionAttributes {
+  
+  private final static boolean DEFAULT_PRIMARY_STATUS = false;
+  
+  private final static int DEFAULT_NUM_BUCKETS = 1;
+
+  /**
+   * Creates an instance of <code>FixedPartitionAttributes</code>.
+   * 
+   * @param name
+   *          Name of the fixed partition.
+   */
+  final public static FixedPartitionAttributes createFixedPartition(String name) {
+    return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary(
+        DEFAULT_PRIMARY_STATUS).setNumBuckets(DEFAULT_NUM_BUCKETS);
+  }
+
+  /**
+   * Creates an instance of <code>FixedPartitionAttributes</code>.
+   * 
+   * @param name
+   *          Name of the fixed partition.
+   * @param isPrimary
+   *          True if this member is the primary for the partition.
+   */
+  final public static FixedPartitionAttributes createFixedPartition(
+      String name, boolean isPrimary) {
+    return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary(
+        isPrimary).setNumBuckets(DEFAULT_NUM_BUCKETS);
+  }
+
+  /**
+   * Creates an instance of <code>FixedPartitionAttributes</code>.
+   * 
+   * @param name
+   *          Name of the fixed partition.
+   * @param isPrimary
+   *          True if this member is the primary for the partition.
+   * @param numBuckets
+   *          Number of buckets allowed for the partition.
+   */
+  final public static FixedPartitionAttributes createFixedPartition(
+      String name, boolean isPrimary, int numBuckets) {
+    return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary(
+        isPrimary).setNumBuckets(numBuckets);
+  }
+
+  /**
+   * Creates an instance of <code>FixedPartitionAttributes</code>.
+   * 
+   * @param name
+   *          Name of the fixed partition.
+   * @param numBuckets
+   *          Number of buckets allowed for the partition.
+   */
+  final public static FixedPartitionAttributes createFixedPartition(
+      String name, int numBuckets) {
+    return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary(
+        DEFAULT_PRIMARY_STATUS).setNumBuckets(numBuckets);
+  }
+
+  /**
+   * Returns the name of the fixed partition.
+   */
+  public abstract String getPartitionName();
+
+  /**
+   * Returns whether this member is the primary for the partition.
+   * 
+   * @return True if this member is the primary, false otherwise.
+   */
+  public abstract boolean isPrimary();
+
+  /**
+   * Returns the number of buckets allowed for the partition.
+   */
+  public abstract int getNumBuckets();
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/FixedPartitionResolver.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/FixedPartitionResolver.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/FixedPartitionResolver.java
new file mode 100644
index 0000000..4864ccc
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/FixedPartitionResolver.java
@@ -0,0 +1,71 @@
+/*
+ * ========================================================================= 
+ * 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;
+
+/**
+ * Implementers of interface <code>FixedPartitionResolver</code> helps to
+ * achieve explicit mapping of a "user defined" partition to a data member node.
+ * <p>
+ * GemFire uses the partition name returned by {@link FixedPartitionResolver#getPartitionName(EntryOperation, Set)} to determine on
+ * which member the data is being managed. Say, for example, you want to
+ * partition all Trades according to quarters. You can implement
+ * FixedPartitionResolver to get the name of the quarter based on the date given
+ * as part of {@link com.gemstone.gemfire.cache.EntryOperation}.
+ * </p>
+ * 
+ * public class QuarterPartitionResolver implements FixedPartitionResolver{<br>
+ * &nbsp &nbsp public String getPartitionName(EntryOperation opDetails, Set
+ * allAvailablePartitions) {<br>
+ * &nbsp &nbsp Date date = sdf.parse((String)opDetails.getKey());<br>
+ * &nbsp &nbsp Calendar cal = Calendar.getInstance();<br>
+ * &nbsp &nbsp cal.setTime(date);<br>
+ * &nbsp &nbsp int month = cal.get(Calendar.MONTH);<br>
+ * &nbsp &nbsp if (month == 0 || month == 1 || month == 2) {<br>
+ * &nbsp &nbsp &nbsp return "Quarter1";<br>
+ * &nbsp &nbsp }<br>
+ * &nbsp &nbsp else if (month == 3 || month == 4 || month == 5) {<br>
+ * &nbsp &nbsp &nbsp return "Quarter2";<br>
+ * &nbsp &nbsp }<br>
+ * &nbsp &nbsp else if (month == 6 || month == 7 || month == 8) {<br>
+ * &nbsp &nbsp &nbsp return "Quarter3";<br>
+ * &nbsp &nbsp }<br>
+ * &nbsp &nbsp else if (month == 9 || month == 10 || month == 11) {<br>
+ * &nbsp &nbsp &nbsp return "Quarter4";<br>
+ * &nbsp &nbsp }<br>
+ * &nbsp &nbsp else {<br>
+ * &nbsp &nbsp &nbsp return "Invalid Quarter";<br>
+ * &nbsp &nbsp }<br>
+ * &nbsp }<br>
+ *
+ * @see PartitionResolver
+ * @author kbachhav
+ * @since 6.6
+ *
+ * 
+ */
+public interface FixedPartitionResolver<K, V> extends PartitionResolver<K, V> {
+
+  /**
+   * This method is used to get the name of the partition for the given entry
+   * operation.
+   * 
+   * @param opDetails
+   *          the details of the entry operation e.g. {@link Region#get(Object)}
+   * @param targetPartitions
+   *           Avoid using this parameter.This set is deprecated from 8.0 and same will be removed in future release.
+   *           Represents all the available primary partitions on the nodes.
+   * 
+   * @return partition-name associated with node which allows mapping of given
+   *         data to user defined partition
+   */
+  public String getPartitionName(EntryOperation<K, V> opDetails,
+      @Deprecated Set<String> targetPartitions);
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GatewayConfigurationException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GatewayConfigurationException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GatewayConfigurationException.java
new file mode 100644
index 0000000..e0c0d80
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GatewayConfigurationException.java
@@ -0,0 +1,36 @@
+/*=========================================================================
+ * 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;
+
+
+/**
+ * An exception indicating that a gateway configuration
+ * will not work with the remote side of the gateway's configuration.
+ * @since 6.6
+ */
+public class GatewayConfigurationException extends GatewayException {
+
+  public GatewayConfigurationException() {
+    super();
+  }
+
+  public GatewayConfigurationException(String msg, Throwable cause) {
+    super(msg, cause);
+  }
+
+  public GatewayConfigurationException(String msg) {
+    super(msg);
+  }
+
+  public GatewayConfigurationException(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/GatewayException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GatewayException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GatewayException.java
new file mode 100755
index 0000000..1ae62da
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GatewayException.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;
+
+/**
+ * An exception thrown by a <code>Gateway</code>.
+ *
+ * @author Barry Oglesby
+ *
+ * @since 4.2
+ */
+public class GatewayException extends OperationAbortedException {
+private static final long serialVersionUID = 8090143153569084886L;
+
+  /**
+   * Constructor.
+   * Creates a new instance of <code>GatewayException</code>.
+   */
+  public GatewayException() {
+  }
+
+  /**
+   * Constructor.
+   * Creates an instance of <code>GatewayException</code> with the
+   * specified detail message.
+   * @param msg the detail message
+   */
+  public GatewayException(String msg) {
+    super(msg);
+  }
+
+  /**
+   * Constructor.
+   * Creates an instance of <code>GatewayException</code> with the
+   * specified detail message
+   * and cause.
+   * @param msg the detail message
+   * @param cause the causal Throwable
+   */
+  public GatewayException(String msg, Throwable cause) {
+    super(msg, cause);
+  }
+
+  /**
+   * Constructor.
+   * Creates an instance of <code>GatewayException</code> with the
+   * specified cause.
+   * @param cause the causal Throwable
+   */
+  public GatewayException(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/GemFireCache.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GemFireCache.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GemFireCache.java
new file mode 100644
index 0000000..4ed4dfb
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GemFireCache.java
@@ -0,0 +1,254 @@
+/*=========================================================================
+ * 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.InputStream;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.naming.Context;
+
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.control.ResourceManager;
+import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.pdx.PdxSerializer;
+
+/**
+ * GemFireCache represents the singleton cache that must be created
+ * in order to use GemFire in a Java virtual machine.
+ * Users must create either a {@link Cache} for a peer/server JVM
+ * or a {@link ClientCache} for a client JVM.
+ * Instances of this interface are created using one of the following methods:
+ * <ul>
+ * <li> {@link CacheFactory#create()} creates a peer/server instance of {@link Cache}.
+ * <li> {@link ClientCacheFactory#create()} creates a client instance of {@link ClientCache}.
+ * </ul>
+ *
+ * @since 6.5
+ * @author darrel
+ */
+public interface GemFireCache extends RegionService {
+  /** Returns the name of this cache.
+   * This method does not throw
+   * <code>CacheClosedException</code> if the cache is closed.
+   * @return the String name of this cache
+   */
+  public String getName();
+  /**
+   * Returns the distributed system used by this cache.
+   * This method does not throw
+   * <code>CacheClosedException</code> if the cache is closed.
+   */
+  public DistributedSystem getDistributedSystem();
+  /**
+   * Returns the <code>ResourceManager</code> for managing this cache's 
+   * resources.
+   * 
+   * @return <code>ResourceManager</code> for managing this cache's resources
+   * @since 6.0
+   */
+  public ResourceManager getResourceManager();
+
+  /**
+   * Sets the "copy on read" feature for cache read operations.
+   *
+   * @since 4.0
+   */
+  public void setCopyOnRead(boolean copyOnRead);
+
+  /**
+   * Indicates whether the "copy on read" is enabled for this cache.
+   * 
+   * @return true if "copy on read" is enabled, false otherwise.
+   *
+   * @since 4.0
+   */
+  public boolean getCopyOnRead();
+
+  /**
+   * Returns the <code>RegionAttributes</code> with the given
+   * <code>id</code> or <code>null</code> if no
+   * <code>RegionAttributes</code> with that id exists.
+   *
+   * @see #setRegionAttributes
+   *
+   * @since 4.1
+   */
+  public <K,V> RegionAttributes<K,V> getRegionAttributes(String id);
+
+  /**
+   * Sets the <code>id</code> of the given
+   * <code>RegionAttributes</code>.  If a region attributes named
+   * <code>name</code> already exists, the mapping will be overwritten
+   * with <code>attrs</code>.  However, changing the mapping will not
+   * effect existing regions.
+   *
+   * @param id
+   *        The id of the region attributes
+   * @param attrs
+   *        The attributes to associate with <code>id</code>.  If
+   *        <code>attrs</code> is <code>null</code>, any existing
+   *        <code>RegionAttributes</code> associated with
+   *        <code>id</code> will be removed.
+   *
+   * @see #getRegionAttributes
+   *
+   * @since 4.1
+   */
+  public <K,V> void setRegionAttributes(String id, RegionAttributes<K,V> attrs);
+
+  /**
+   * Returns an unmodifiable mapping of ids to region attributes.  The
+   * keys of the map are {@link String}s and the values of the map are
+   * {@link RegionAttributes}.
+   *
+   * @since 4.1
+   */
+  public <K,V> Map<String, RegionAttributes<K,V>> listRegionAttributes();
+
+  /**
+   * Loads the cache configuration described in a <a
+   * href="package-summary.html#declarative">declarative caching XML
+   * file</a> into this cache.  If the XML describes a region that
+   * already exists, any mutable region attributes, indexes, and
+   * region entries that are defined in the XML are updated/added.
+   *
+   * <P>
+   *
+   * Because this method may perform a {@link Region#put(Object, Object) put} on a
+   * <code>Region</code>, it declares that it throws a
+   * <code>TimeoutException</code>, <code>CacheWriterException</code>,
+   * <code>GatewayException</code>,
+   * or <code>RegionExistsException</code>.
+   *
+   * @throws CacheXmlException
+   *         If the XML read from <code>is</code> does not conform to
+   *         the dtd or if an <code>IOException</code> occurs while
+   *         reading the XML.
+   *
+   * @since 4.1
+   */
+  public void loadCacheXml(InputStream is) 
+    throws TimeoutException, CacheWriterException,
+           GatewayException,
+           RegionExistsException;
+
+  /**
+   * Gets the logging object for GemFire.
+   * This method does not throw
+   * <code>CacheClosedException</code> if the cache is closed.
+   * @return the logging object
+   */
+  public LogWriter getLogger();
+
+  /**
+   * Gets the security logging object for GemFire.
+   * This method does not throw
+   * <code>CacheClosedException</code> if the cache is closed.
+   * @return the security logging object
+   */
+  public LogWriter getSecurityLogger();
+
+  /**
+   * Returns the DiskStore by name or <code>null</code> if no disk store is found.
+   * @param name the name of the disk store to find. If <code>null</code> then the
+   * default disk store, if it exists, is returned.
+   * @since 6.5
+   */
+  public DiskStore findDiskStore(String name);
+  
+  /**
+   * create diskstore factory 
+   * 
+   * @since 6.5
+   */
+  public DiskStoreFactory createDiskStoreFactory();
+  
+  public GatewaySenderFactory createGatewaySenderFactory();
+  
+  /**
+   * Returns whether { @link PdxInstance} is preferred for PDX types instead of Java object.
+   * @see com.gemstone.gemfire.cache.CacheFactory#setPdxReadSerialized(boolean)
+   * @see com.gemstone.gemfire.cache.client.ClientCacheFactory#setPdxReadSerialized(boolean)
+   * 
+   * @since 6.6
+   */
+  public boolean getPdxReadSerialized();
+  
+  /**
+   * Returns the PdxSerializer used by this cache, or null
+   * if no PDX serializer is defined.
+   * 
+   * @since 6.6
+   * @see CacheFactory#setPdxSerializer(PdxSerializer)
+   * @see ClientCacheFactory#setPdxSerializer(PdxSerializer)
+   */
+  public PdxSerializer getPdxSerializer();
+  
+  /**
+   * Returns the disk store used for PDX meta data
+   * @since 6.6
+   * @see CacheFactory#setPdxDiskStore(String)
+   * @see ClientCacheFactory#setPdxDiskStore(String)
+   */
+  public String getPdxDiskStore();
+  
+  /**
+   * Returns true if the PDX metadata for this
+   * cache is persistent
+   * @since 6.6
+   * @see CacheFactory#setPdxPersistent(boolean)
+   * @see ClientCacheFactory#setPdxPersistent(boolean)
+   */
+  public boolean getPdxPersistent();
+  /**
+   * Returns true if fields that are not read during PDX deserialization
+   * should be ignored during the PDX serialization.
+   * @since 6.6
+   * @see CacheFactory#setPdxIgnoreUnreadFields(boolean)
+   * @see ClientCacheFactory#setPdxIgnoreUnreadFields(boolean)
+   */
+  public boolean getPdxIgnoreUnreadFields();
+  /**
+   * Get the CacheTransactionManager instance for this Cache.
+   *
+   * @return The CacheTransactionManager instance.
+   *
+   * @throws CacheClosedException if the cache is closed.
+   *
+   * @since 4.0
+   */
+  public CacheTransactionManager getCacheTransactionManager();
+  /**
+   * Returns the JNDI context associated with the Cache.
+   * @return javax.naming.Context
+   * Added as part of providing JTA implementation in Gemfire.
+   *
+   * @since 4.0
+   */
+  public Context getJNDIContext();
+
+  /**
+   * Returns the Declarable used to initialize this cache or <code>null</code>
+   * if it does not have an initializer.
+   * @since 6.6
+   */
+  public Declarable getInitializer();
+
+  /**
+   * Returns the Properties used to initialize the cache initializer or
+   * <code>null</code> if no initializer properties exist.
+   * @since 6.6
+   */
+  public Properties getInitializerProps();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/IncompatibleVersionException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/IncompatibleVersionException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/IncompatibleVersionException.java
new file mode 100755
index 0000000..27bdb25
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/IncompatibleVersionException.java
@@ -0,0 +1,39 @@
+/*=========================================================================
+ * 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>IncompatibleVersionException</code> that the client version
+ * was not compatible with the server version.
+ *
+ * @since 5.7
+ */
+public class IncompatibleVersionException extends VersionException {
+private static final long serialVersionUID = 668812986092856749L;
+
+  /**
+   * Constructs a new <code>IncompatibleVersionException</code>.
+   *
+   * @param clientVersion The client <code>Version</code>
+   * @param serverVersion The server <code>Version</code>
+   */
+  public IncompatibleVersionException(Object/*Version*/ clientVersion,
+      Object/*Version*/ serverVersion) {
+    this("Client version " + clientVersion
+        + " is incompatible with server version " + serverVersion);
+  }
+
+  /**
+   * Constructs a new <code>IncompatibleVersionException</code>.
+   *
+   * @param message The exception message
+   */
+  public IncompatibleVersionException(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/InterestPolicy.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestPolicy.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestPolicy.java
new file mode 100644
index 0000000..f066c82
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestPolicy.java
@@ -0,0 +1,140 @@
+/*=========================================================================
+ * 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.*;
+
+/**
+ * Enumerated type for region subscription interest policy.
+ * The interest policy specifies what data a subscriber is interested in having
+ * in it's region.
+ *
+ * @author Darrel Schneider
+ *
+ *
+ * @see SubscriptionAttributes
+ *
+ * @since 5.0
+ */
+public class InterestPolicy implements java.io.Serializable {
+  private static final long serialVersionUID = 1567179436331385968L;
+
+  private static byte nextOrdinal = 0;
+    
+  private static final InterestPolicy[] VALUES = new InterestPolicy[2];
+
+  /**
+   * This subscriber is interested in all data.
+   * More specifically operations done in this cache and
+   * distributed operations done in remote caches.
+   * <p>
+   * When combined with {@link DataPolicy#EMPTY} this region will receive
+   * events for every distributed operation but will not store the data.
+   * <p>
+   * When combined with {@link DataPolicy#NORMAL} or
+   * {@link DataPolicy#PRELOADED} this region will accept
+   * {@link Region#create(Object, Object)} operations done remotely. Without
+   * the <code>ALL</code> interest policy, <code>NORMAL</code> and
+   * <code>PRELOADED</code> ignore <code>creates</code> that the region
+   * does  not have an existing entry for.
+   * <p>
+   * When combined with the {@link DataPolicy#withReplication replication
+   * policies} this interest has no effect.
+   * <p>
+   * When combined with {@link DataPolicy#PARTITION} this interest policy
+   * causes cache listeners to be notified of changes regardless of the
+   * physical location of the data affected.  That is, a listener in a VM
+   * using this policy will receive notification of all changes to the
+   * partitioned region.
+   */
+  public static final InterestPolicy ALL = new InterestPolicy("ALL");
+
+  /**
+   * This subscriber is interested in data that is already in its cache.
+   * More specifically operations done in this cache and
+   * distributed operations done in remote caches.
+   * <p>
+   * When combined with {@link DataPolicy#EMPTY} this region will never
+   * receive events for distributed operations since its content is always
+   * empty.  It will continue to get events for operations done locally.
+   * <p>
+   * When combined with {@link DataPolicy#NORMAL} or
+   * {@link DataPolicy#PRELOADED} this region will accept remote operations
+   * done to entries it already has in its cache.
+   * <p>
+   * When combined with the {@link DataPolicy#withReplication replication
+   * policies} * this interest has no effect.
+   * <p>
+   * When combined with {@link DataPolicy#PARTITION} this interest policy
+   * causes cache listeners to be notified in the VM holding the affected data.
+   *  That is, listeners are only notified if the affected* key-value pair is
+   * in the same process as the listener.
+   */
+  public static final InterestPolicy CACHE_CONTENT = new InterestPolicy("CACHE_CONTENT");
+
+  /**
+   * The interest policy used by default; it is {@link #CACHE_CONTENT}.
+   */
+  public static final InterestPolicy DEFAULT = CACHE_CONTENT;
+
+    
+  /** The name of this mirror type. */
+  private final transient String name;
+    
+  /** used as ordinal to represent this InterestPolicy */
+  public final byte ordinal;
+
+  private Object readResolve() throws ObjectStreamException {
+    return VALUES[ordinal];  // Canonicalize
+  }
+    
+    
+  /** Creates a new instance of InterestPolicy. */
+  private InterestPolicy(String name) {
+    this.name = name;
+    this.ordinal = nextOrdinal++;
+    VALUES[this.ordinal] = this;
+  }
+    
+  /** Return the InterestPolicy represented by specified ordinal */
+  public static InterestPolicy fromOrdinal(byte ordinal) {
+    return VALUES[ordinal];
+  }
+    
+    
+  /**
+   * Return true if this policy is {@link #ALL}.
+   * @return true if this policy is {@link #ALL}.
+   */
+  public boolean isAll() {
+    return this == ALL;
+  }
+  /**
+   * Return true if this policy is {@link #CACHE_CONTENT}.
+   * @return true if this policy is {@link #CACHE_CONTENT}.
+   */
+  public boolean isCacheContent() {
+    return this == CACHE_CONTENT;
+  }
+  /**
+   * Return true if this policy is the default.
+   * @return true if this policy is the default.
+   */
+  public boolean isDefault() {
+    return this == DEFAULT;
+  }
+  
+  /** Returns a string representation for this interest policy.
+     * @return the name of this interest policy.
+     */
+  @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/InterestRegistrationEvent.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestRegistrationEvent.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestRegistrationEvent.java
new file mode 100755
index 0000000..187bc33
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestRegistrationEvent.java
@@ -0,0 +1,83 @@
+/*=========================================================================
+ * 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;
+
+import com.gemstone.gemfire.internal.cache.tier.InterestType;
+
+/**
+ * Interface <code>InterestRegistrationEvent</code> encapsulated interest
+ * event information like region and keys of interest.
+ *
+ * @author Barry Oglesby
+ * @since 6.0
+ */
+public interface InterestRegistrationEvent {
+
+  /**
+   * Returns the name of the region to which this interest event belongs.
+   *
+   * @return the name of the region to which this interest event belongs
+   */
+  public String getRegionName();
+  
+  /**
+   * Returns the region to which this interest belongs.
+   * 
+   * @return the region to which this interest belongs
+   */
+  public Region<?,?> getRegion(); 
+
+  /**
+   * Returns a <code>Set</code> of keys of interest.
+   * 
+   * @return a <code>Set</code> of keys of interest
+   */
+  public Set<?> getKeysOfInterest();
+
+  /**
+   * Returns this event's interest type.
+   *
+   * @return this event's interest type
+   */
+  public int getInterestType();
+
+  /**
+   * Returns whether this event represents a register interest.
+   *
+   * @return whether this event represents a register interest
+   */
+  public boolean isRegister();
+
+  /**
+   * Returns whether this event's interest type is
+   * {@link InterestType#KEY}.
+   *
+   * @return whether this event's interest type is
+   *         {@link InterestType#KEY}
+   */
+  public boolean isKey();
+
+  /**
+   * Returns whether this event's interest type is
+   * {@link InterestType#REGULAR_EXPRESSION}.
+   *
+   * @return whether this event's interest type is
+   *         {@link InterestType#REGULAR_EXPRESSION}
+   */
+  public boolean isRegularExpression();
+  
+  /** 
+   * Returns the {@link ClientSession} that initiated this event 
+   *  
+   * @return the {@link ClientSession} that initiated this event 
+   */ 
+  public ClientSession getClientSession(); 
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestRegistrationListener.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestRegistrationListener.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestRegistrationListener.java
new file mode 100755
index 0000000..3a0f509
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestRegistrationListener.java
@@ -0,0 +1,75 @@
+/*=========================================================================
+ * 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;
+
+/**
+ * Interface <code>InterestRegisterationListener</code> provides the ability for
+ * applications to be notified of interest registration and unregistration
+ * events. Instances must be implemented by applications and registered in
+ * <code>CacheServer</code> VMs using the
+ * {@link com.gemstone.gemfire.cache.server.CacheServer#registerInterestRegistrationListener
+ * registerInterestRegistrationListener} API. The methods on an
+ * <code>InterestRegisterationListener</code> are invoked synchronously with the
+ * interest event in any <code>CacheServer</code> VM hosting the requesting
+ * client's subscriptions.
+ *
+ * <p>Shown below is an example implementation.
+ *
+ * <pre>
+ *import com.gemstone.gemfire.cache.InterestRegistrationEvent;
+ *import com.gemstone.gemfire.cache.InterestRegistrationListener;
+ *
+ *public class TestInterestRegistrationListener implements InterestRegistrationListener {
+ *
+ *  public void afterRegisterInterest(InterestRegistrationEvent event) {
+ *    System.out.println("afterRegisterInterest: " + event.getRegionName() + " -> " + event.getKeysOfInterest());
+ *  }
+
+ *  public void afterUnregisterInterest(InterestRegistrationEvent event) {
+ *    System.out.println("afterUnregisterInterest: " + event.getRegionName() + " -> " + event.getKeysOfInterest());
+ *  }
+ *
+ *  public void close() {}
+ *}
+ * </pre>
+ *
+ * Shown below is an example registration.
+ *
+ * <pre>
+ *private void registerInterestRegistrationListener() {
+ *  Cache cache = ...;
+ *  CacheServer cs = cache.getCacheServers().iterator().next();
+ *  InterestRegistrationListener listener = new TestInterestRegistrationListener();
+ *  cs.registerInterestRegistrationListener(listener);
+ *}
+ * </pre>
+ *
+ * @author Barry Oglesby
+ *
+ * @since 6.0
+ * 
+ * @see com.gemstone.gemfire.cache.server.CacheServer#registerInterestRegistrationListener registerInterestRegistrationListener
+ * @see com.gemstone.gemfire.cache.server.CacheServer#unregisterInterestRegistrationListener unregisterInterestRegistrationListener
+ */
+public interface InterestRegistrationListener extends CacheCallback {
+
+  /**
+   * Handles an after register interest event.
+   *
+   * @param event the InterestRegistrationEvent
+   */
+  public void afterRegisterInterest(InterestRegistrationEvent event);
+
+  /**
+   * Handles an after unregister interest event.
+   *
+   * @param event the InterestRegistrationEvent
+   */
+  public void afterUnregisterInterest(InterestRegistrationEvent event);
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestResultPolicy.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestResultPolicy.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestResultPolicy.java
new file mode 100755
index 0000000..38bf314
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/InterestResultPolicy.java
@@ -0,0 +1,113 @@
+/*=========================================================================
+ * 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.cache.tier.sockets.InterestResultPolicyImpl;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+/**
+ * Class <code>InterestResultPolicy</code> is an enumerated type for a
+ * register interest result. The result of a call to Region.registerInterest
+ * can be the keys and current values, just the keys or nothing.
+ *
+ * @author Barry Oglesby
+ *
+ * @see com.gemstone.gemfire.cache.Region#registerInterest(Object)
+ * @see com.gemstone.gemfire.cache.Region#registerInterestRegex(String)
+ *
+ * @since 4.2.3
+ */
+public class InterestResultPolicy implements Serializable {
+  private static final long serialVersionUID = -4993765891973030160L;
+
+  private static byte nextOrdinal = 0;
+
+  private static final InterestResultPolicy[] VALUES = new InterestResultPolicy[3];
+
+  public static final InterestResultPolicy NONE = new InterestResultPolicyImpl("NONE");
+  public static final InterestResultPolicy KEYS = new InterestResultPolicyImpl("KEYS");
+  public static final InterestResultPolicy KEYS_VALUES = new InterestResultPolicyImpl("KEYS_VALUES");
+
+  /**
+   * The <code>InterestResultPolicy</code> used by default; it is {@link #KEYS_VALUES}.
+   */
+  public static final InterestResultPolicy DEFAULT = KEYS_VALUES;
+
+
+  /** The name of this <code>InterestResultPolicy</code>. */
+  private final transient String name;
+
+  /** The ordinal representing this <code>InterestResultPolicy</code>. */
+  public final byte ordinal;
+
+  protected Object readResolve() throws ObjectStreamException {
+    return VALUES[ordinal];  // Canonicalize
+  }
+
+
+  /** should only be called from InterestResultPolicyImpl */
+  protected InterestResultPolicy(String name) {
+    this.name = name;
+    this.ordinal = nextOrdinal++;
+    VALUES[this.ordinal] = this;
+  }
+
+  /** Returns the <code>InterestResultPolicy</code> represented by specified ordinal */
+  public static InterestResultPolicy fromOrdinal(byte ordinal) {
+    return VALUES[ordinal];
+  }
+  /** Returns the ordinal value.
+   * @since 5.0
+   */
+  public byte getOrdinal() {
+    return this.ordinal;
+  }
+
+  /**
+   * Returns true if this <code>InterestResultPolicy</code> is {@link #NONE}.
+   * @return true if this <code>InterestResultPolicy</code> is {@link #NONE}.
+   */
+  public boolean isNone() {
+    return this == NONE;
+  }
+
+  /**
+   * Returns true if this <code>InterestResultPolicy</code> is {@link #KEYS}.
+   * @return true if this <code>InterestResultPolicy</code> is {@link #KEYS}.
+   */
+  public boolean isKeys() {
+    return this == KEYS;
+  }
+
+  /**
+   * Returns true if this <code>InterestResultPolicy</code> is {@link #KEYS_VALUES}.
+   * @return true if this <code>InterestResultPolicy</code> is {@link #KEYS_VALUES}.
+   */
+  public boolean isKeysValues() {
+    return this == KEYS_VALUES;
+  }
+
+  /**
+   * Returns true if this <code>InterestResultPolicy</code> is the default.
+   * @return true if this <code>InterestResultPolicy</code> is the default.
+   */
+  public boolean isDefault() {
+    return this == DEFAULT;
+  }
+
+  /** Returns a string representation for this <code>InterestResultPolicy</code>.
+   * @return the name of this data policy.
+   */
+  @Override // GemStoneAddition
+  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/LoaderHelper.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/LoaderHelper.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/LoaderHelper.java
new file mode 100644
index 0000000..b2cdb2f
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/LoaderHelper.java
@@ -0,0 +1,72 @@
+/*=========================================================================
+ * 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;
+
+/** Provides a set of APIs to help the
+ * implementation of the <code>CacheLoader</code> load method. An instance of <code>LoaderHelper</code>
+ * is only valid within the {@link CacheLoader#load(LoaderHelper) load}
+ * method.
+ *
+ * @author Dave Monnie
+ *
+ * @see CacheLoader#load(LoaderHelper) load
+ * @since 2.0
+ */
+public interface LoaderHelper<K,V>
+{
+  /** Searches other caches for the value to be loaded. If the cache
+   * is part of a distributed caching system, <code>netSearch</code>
+   * will try to locate the requested value in any other cache within
+   * the system.  If the search is successful, a reference to a local
+   * copy of the value is returned. If there is no value for this
+   * entry present in the system, and doNetLoad is true, GemFire looks
+   * for and invokes <code>CacheLoaders</code> in other nodes in the
+   * system.  The net load will invoke one loader at a time until a
+   * loader either returns a non-null value or throws an exception.
+   * If the object is not found, <code>null</code> is returned.
+   *
+   * @param doNetLoad 
+   *        if true, and there is no valid value found for this entry
+   *        in the system, then look for and invoke loaders on other
+   *        nodes
+   *
+   * @return the requested value or null if not found
+   *
+   * @throws TimeoutException if the netSearch times out before
+   *         getting a response from another cache
+   * @throws CacheLoaderException
+   *         If <code>netSearch</code> is attempted on a {@linkplain
+   *         com.gemstone.gemfire.cache.Scope#LOCAL local} region. 
+   */
+  public V netSearch(boolean doNetLoad)
+    throws CacheLoaderException, TimeoutException;
+
+  /**
+   * Returns the key for the value being loaded.
+   *
+   * @return the name Object for the object being loaded
+   * @see CacheLoader#load(LoaderHelper) load
+   */
+  public K getKey();
+
+  /**
+   * Returns the region to which the entry belongs.
+   *
+   * @return the name of the region for the object being loaded
+   * @see CacheLoader#load(LoaderHelper) load
+   */
+  public Region<K,V> getRegion();
+
+  /** Return the argument object for the load method that was passed in from
+   * application code. This object is passed in as <i>aLoaderArgument</i> in
+   * {@link Region#get(Object, Object) get}.
+   * @return the argument or null if one was not supplied
+   */
+  public Object getArgument();
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/cache/LossAction.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/LossAction.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/LossAction.java
new file mode 100755
index 0000000..79e51da
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/LossAction.java
@@ -0,0 +1,140 @@
+/*=========================================================================
+ * 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 access to the region is affected when one or more required
+ * roles are lost. A role is lost when it is are offline and no longer
+ * present in the system membership.
+ * The <code>LossAction</code> is specified when configuring a region's
+ * {@link com.gemstone.gemfire.cache.MembershipAttributes}.
+ * 
+ * @author Kirk Lund
+ * @since 5.0
+ */
+public class LossAction implements Serializable {
+  private static final long serialVersionUID = -832035480397447797L;
+
+  // NOTE: to change/add these files are impacted:
+  //   LossAction, package.html
+  
+  /**
+   * The region is unavailable when required roles are missing. All operations
+   * including read and write access are denied.  All read and write operations
+   * on the region will result in {@link RegionAccessException} while any 
+   * required roles are absent.  Basic administration of the region is allowed,
+   * including {@linkplain Region#close close} and 
+   * {@linkplain Region#localDestroyRegion() localDestroyRegion}.
+   */
+  public static final LossAction NO_ACCESS = 
+      new LossAction("NO_ACCESS");
+
+  /** 
+   * Only local access to the region is allowed when required roles are 
+   * missing.  All distributed write operations on the region will throw 
+   * {@link RegionAccessException} while any required roles are absent.
+   * Reads which result in a netSearch behave normally, while any attempt
+   * to invoke a netLoad is not allowed.
+   */
+  public static final LossAction LIMITED_ACCESS = 
+      new LossAction("LIMITED_ACCESS");
+
+  /** 
+   * Access to the region is unaffected when required roles are missing. 
+   */
+  public static final LossAction FULL_ACCESS = 
+      new LossAction("FULL_ACCESS");
+
+  /** 
+   * Loss of required roles causes the entire cache to be closed. In addition,
+   * this process will disconnect from the DistributedSystem and then
+   * reconnect. Attempting to use any existing references to the regions
+   * or cache will throw a {@link CacheClosedException}.
+   */
+  public static final LossAction RECONNECT = 
+      new LossAction("RECONNECT");
+
+  /** 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 LossAction[] PRIVATE_VALUES =
+    { NO_ACCESS, LIMITED_ACCESS, FULL_ACCESS, RECONNECT };
+  
+  /** List of all LossAction 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 LossAction. */
+  private LossAction(String name) {
+      this.name = name;
+  }
+  
+  /** Return the LossAction represented by specified ordinal */
+  public static LossAction fromOrdinal(byte ordinal) {
+    return PRIVATE_VALUES[ordinal];
+  }
+  
+  /** Return the LossAction specified by name */
+  public static LossAction fromName(String name) {
+    if (name == null || name.length() == 0) {
+      throw new IllegalArgumentException(LocalizedStrings.LossAction_INVALID_LOSSACTION_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.LossAction_INVALID_LOSSACTION_NAME_0.toLocalizedString(name));
+  }
+  
+  /** Returns true if this is <code>NO_ACCESS</code>. */
+  public boolean isNoAccess() {
+    return this == NO_ACCESS;
+  }
+  
+  /** Returns true if this is <code>LIMITED_ACCESS</code>. */
+  public boolean isLimitedAccess() {
+    return this == LIMITED_ACCESS;
+  }
+  
+  /** Returns true if this is <code>FULL_ACCESS</code>. */
+  public boolean isAllAccess() {
+    return this == FULL_ACCESS;
+  }
+  
+  /** Returns true if this is <code>RECONNECT</code>. */
+  public boolean isReconnect() {
+    return this == RECONNECT;
+  }
+  
+  /** 
+   * Returns a string representation for this loss action.
+   * @return the name of this loss 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/LowMemoryException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/LowMemoryException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/LowMemoryException.java
new file mode 100644
index 0000000..6bd1101
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/LowMemoryException.java
@@ -0,0 +1,58 @@
+/*=========================================================================
+ * 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.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import com.gemstone.gemfire.cache.control.ResourceManager;
+import com.gemstone.gemfire.distributed.DistributedMember;
+
+/**
+ * Indicates a low memory condition either on the local or a remote {@link Cache}.
+ * The {@link ResourceManager} monitors local tenured memory consumption and determines when operations are rejected.
+ * 
+ * @see ResourceManager#setCriticalHeapPercentage(float)
+ * @see Region#put(Object, Object)
+ * 
+ * @author sbawaska
+ * @since 6.0
+ */
+public class LowMemoryException extends ResourceException {
+
+  private static final long serialVersionUID = 6585765466722883168L;
+  private final Set<DistributedMember> critMems;
+
+  /**
+   * Creates a new instance of <code>LowMemoryException</code>.
+   */
+  public LowMemoryException() {
+    this.critMems = Collections.emptySet();
+  }
+
+  /**
+   * Constructs an instance of <code>LowMemoryException</code> with the specified detail message.
+   * @param msg the detail message
+   * @param criticalMembers the member(s) which are/were in a critical state
+   */
+  public LowMemoryException(String msg, final Set<DistributedMember> criticalMembers) {
+    super(msg);
+    this.critMems = Collections.unmodifiableSet(criticalMembers);
+  }
+
+  /**
+   * Get a read-only set of members in a critical state at the time this
+   * exception was constructed.
+   * @return the critical members
+   */
+  public Set<DistributedMember> getCriticalMembers() {
+    return this.critMems;
+  }
+}