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

[06/20] incubator-geode git commit: move ChunkFactory out of SimpleMemoryAllocatorImpl

move ChunkFactory 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/9d5905d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/9d5905d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/9d5905d6

Branch: refs/heads/feature/GEODE-580
Commit: 9d5905d62864f74a21ad20dbb65469fcf61122e4
Parents: 419b017
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Thu Nov 19 15:38:07 2015 -0800
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Thu Nov 19 15:38:07 2015 -0800

----------------------------------------------------------------------
 .../gemfire/internal/offheap/ChunkFactory.java  | 52 ++++++++++++++++++++
 .../offheap/SimpleMemoryAllocatorImpl.java      | 28 -----------
 2 files changed, 52 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9d5905d6/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/ChunkFactory.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/ChunkFactory.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/ChunkFactory.java
new file mode 100644
index 0000000..467649e
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/ChunkFactory.java
@@ -0,0 +1,52 @@
+/*
+ * 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.ChunkType;
+
+/**
+ * ChunkFactory can be used to create Chunk instances.
+ * It can also be used to determine the ChunkType given a Chunk address
+ * or the object header bits from an existing Chunk.
+ */
+public interface ChunkFactory  {
+  /**
+   * Create a new chunk of the given size and type at the given address.
+   */
+  Chunk newChunk(long address, int chunkSize, ChunkType chunkType);
+  /**
+   * Create a new chunk for a block of memory (identified by address)
+   * that has already been allocated.
+   * The size and type are derived from the existing object header.
+   */
+  Chunk newChunk(long address);
+  /**
+   * Create a new chunk of the given type for a block of memory (identified by address)
+   * that has already been allocated.
+   * The size is derived from the existing object header.
+   */
+  Chunk newChunk(long address, ChunkType chunkType);
+  /**
+   * Given the address of an existing chunk return its ChunkType.
+   */
+  ChunkType getChunkTypeForAddress(long address);
+  /**
+   * Given the rawBits from the object header of an existing chunk
+   * return its ChunkType.
+   */
+  ChunkType getChunkTypeForRawBits(int bits);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9d5905d6/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 ed67b8b..86cba3b 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
@@ -1424,34 +1424,6 @@ public final class SimpleMemoryAllocatorImpl implements MemoryAllocator, MemoryI
   }
   
   
-  public static interface ChunkFactory  {
-    /**
-     * Create a new chunk of the given size and type at the given address.
-     */
-    Chunk newChunk(long address, int chunkSize, ChunkType chunkType);
-    /**
-     * Create a new chunk for a block of memory (identified by address)
-     * that has already been allocated.
-     * The size and type are derived from the existing object header.
-     */
-    Chunk newChunk(long address);
-    /**
-     * Create a new chunk of the given type for a block of memory (identified by address)
-     * that has already been allocated.
-     * The size is derived from the existing object header.
-     */
-    Chunk newChunk(long address, ChunkType chunkType);
-    /**
-     * Given the address of an existing chunk return its ChunkType.
-     */
-    ChunkType getChunkTypeForAddress(long address);
-    /**
-     * Given the rawBits from the object header of an existing chunk
-     * return its ChunkType.
-     */
-    ChunkType getChunkTypeForRawBits(int bits);
-  }
-  
   private static class GemFireChunkFactory implements ChunkFactory {
     @Override
     public Chunk newChunk(long address, int chunkSize, ChunkType chunkType) {