You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2015/11/20 02:07:44 UTC

[09/20] incubator-geode git commit: move GemFireChunk out of SimpleMemoryAllocatorImpl

move GemFireChunk out of SimpleMemoryAllocatorImpl


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/4d10de4c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/4d10de4c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/4d10de4c

Branch: refs/heads/feature/GEODE-580
Commit: 4d10de4c4c400f9e2faf4e27e8e037d118df54f1
Parents: 944e186
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Thu Nov 19 15:48:09 2015 -0800
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Thu Nov 19 15:48:09 2015 -0800

----------------------------------------------------------------------
 .../internal/cache/AbstractRegionEntry.java     |  2 +-
 .../gemfire/internal/offheap/GemFireChunk.java  | 56 ++++++++++++++++++++
 .../internal/offheap/GemFireChunkFactory.java   |  1 -
 .../offheap/SimpleMemoryAllocatorImpl.java      | 31 -----------
 4 files changed, 57 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4d10de4c/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionEntry.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionEntry.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionEntry.java
index 0078f66..cd6218a 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionEntry.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionEntry.java
@@ -62,11 +62,11 @@ import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
 import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
 import com.gemstone.gemfire.internal.offheap.Chunk;
+import com.gemstone.gemfire.internal.offheap.GemFireChunk;
 import com.gemstone.gemfire.internal.offheap.MemoryAllocator;
 import com.gemstone.gemfire.internal.offheap.OffHeapCachedDeserializable;
 import com.gemstone.gemfire.internal.offheap.OffHeapHelper;
 import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl;
-import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl.GemFireChunk;
 import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl.GemFireChunkType;
 import com.gemstone.gemfire.internal.offheap.StoredObject;
 import com.gemstone.gemfire.internal.offheap.annotations.Released;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4d10de4c/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/GemFireChunk.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/GemFireChunk.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/GemFireChunk.java
new file mode 100644
index 0000000..d0d41a6
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/GemFireChunk.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.offheap;
+
+import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl.GemFireChunkSlice;
+
+/**
+ * A chunk that stores a GemFire object.
+ * Currently the object stored in this chunk
+ * is always an entry value of a Region.
+ */
+public class GemFireChunk extends Chunk {
+  public static final ChunkType TYPE = new ChunkType() {
+    @Override
+    public int getSrcType() {
+      return Chunk.SRC_TYPE_GFE;
+    }
+    @Override
+    public Chunk newChunk(long memoryAddress) {
+      return new GemFireChunk(memoryAddress);
+    }
+    @Override
+    public Chunk newChunk(long memoryAddress, int chunkSize) {
+      return new GemFireChunk(memoryAddress, chunkSize);
+    }
+  };
+  public GemFireChunk(long memoryAddress, int chunkSize) {
+    super(memoryAddress, chunkSize, TYPE);
+  }
+
+  public GemFireChunk(long memoryAddress) {
+    super(memoryAddress);
+    // chunkType may be set by caller when it calls readyForAllocation
+  }
+  public GemFireChunk(GemFireChunk chunk) {
+    super(chunk);
+  }
+  @Override
+  public Chunk slice(int position, int limit) {
+    return new GemFireChunkSlice(this, position, limit);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4d10de4c/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/GemFireChunkFactory.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/GemFireChunkFactory.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/GemFireChunkFactory.java
index e8e80aa..c3f3bcc 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/GemFireChunkFactory.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/GemFireChunkFactory.java
@@ -16,7 +16,6 @@
  */
 package com.gemstone.gemfire.internal.offheap;
 
-import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl.GemFireChunk;
 
 /**
  * A ChunkFactory that produces chunks of type GemFireChunk.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4d10de4c/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
index b492bb5..7f2d6e8 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
@@ -1471,37 +1471,6 @@ public final class SimpleMemoryAllocatorImpl implements MemoryAllocator, MemoryI
       return new GemFireChunk(memoryAddress, chunkSize);
     }
   }
-  public static class GemFireChunk extends Chunk {
-    public static final ChunkType TYPE = new ChunkType() {
-      @Override
-      public int getSrcType() {
-        return Chunk.SRC_TYPE_GFE;
-      }
-      @Override
-      public Chunk newChunk(long memoryAddress) {
-        return new GemFireChunk(memoryAddress);
-      }
-      @Override
-      public Chunk newChunk(long memoryAddress, int chunkSize) {
-        return new GemFireChunk(memoryAddress, chunkSize);
-      }
-    };
-    public GemFireChunk(long memoryAddress, int chunkSize) {
-      super(memoryAddress, chunkSize, TYPE);
-    }
-
-    public GemFireChunk(long memoryAddress) {
-      super(memoryAddress);
-      // chunkType may be set by caller when it calls readyForAllocation
-    }
-    public GemFireChunk(GemFireChunk chunk) {
-      super(chunk);
-    }
-    @Override
-    public Chunk slice(int position, int limit) {
-      return new GemFireChunkSlice(this, position, limit);
-    }
-  }
   public static class GemFireChunkSlice extends GemFireChunk {
     private final int offset;
     private final int capacity;