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 2016/03/05 01:51:11 UTC
[11/38] incubator-geode git commit: renamed MemoryChunkWithRefCount
to ObjectStoredOffHeap
renamed MemoryChunkWithRefCount to ObjectStoredOffHeap
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/723612d3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/723612d3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/723612d3
Branch: refs/heads/feature/GEODE-982
Commit: 723612d34792b5d49a92b9845f6abd848cff70d7
Parents: 2f9694b
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Fri Feb 26 17:13:55 2016 -0800
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Fri Feb 26 17:13:55 2016 -0800
----------------------------------------------------------------------
.../gemfire/internal/cache/DiskStoreImpl.java | 2 +-
.../gemfire/internal/cache/RegionEntry.java | 4 +-
.../internal/offheap/MemoryAllocator.java | 2 +-
.../offheap/MemoryChunkWithRefCount.java | 55 --------------------
.../gemfire/internal/offheap/ObjectChunk.java | 2 +-
.../internal/offheap/ObjectStoredOffHeap.java | 55 ++++++++++++++++++++
.../gemfire/internal/offheap/OffHeapHelper.java | 12 ++---
.../offheap/OffHeapRegionEntryHelper.java | 2 +-
.../offheap/SimpleMemoryAllocatorImpl.java | 2 +-
.../gemfire/cache30/MultiVMRegionTestCase.java | 8 +--
.../offheap/MemoryBlockNodeJUnitTest.java | 22 ++++----
.../offheap/OffHeapHelperJUnitTest.java | 10 ++--
.../internal/offheap/OffHeapRegionBase.java | 2 +-
.../offheap/SimpleMemoryAllocatorJUnitTest.java | 34 ++++++------
14 files changed, 106 insertions(+), 106 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskStoreImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskStoreImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskStoreImpl.java
index e4ef21d..3f6762f 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskStoreImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskStoreImpl.java
@@ -110,7 +110,7 @@ import com.gemstone.gemfire.internal.logging.LogService;
import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
-import com.gemstone.gemfire.internal.offheap.MemoryChunkWithRefCount;
+import com.gemstone.gemfire.internal.offheap.ObjectStoredOffHeap;
import com.gemstone.gemfire.internal.offheap.OffHeapHelper;
import com.gemstone.gemfire.internal.offheap.annotations.Released;
import com.gemstone.gemfire.internal.offheap.annotations.Retained;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RegionEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RegionEntry.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RegionEntry.java
index e2cfb90..3b36e6b 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RegionEntry.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RegionEntry.java
@@ -31,7 +31,7 @@ import com.gemstone.gemfire.internal.cache.lru.NewLRUClockHand;
import com.gemstone.gemfire.internal.cache.versions.VersionSource;
import com.gemstone.gemfire.internal.cache.versions.VersionStamp;
import com.gemstone.gemfire.internal.cache.versions.VersionTag;
-import com.gemstone.gemfire.internal.offheap.MemoryChunkWithRefCount;
+import com.gemstone.gemfire.internal.offheap.ObjectStoredOffHeap;
import com.gemstone.gemfire.internal.offheap.annotations.Released;
import com.gemstone.gemfire.internal.offheap.annotations.Retained;
import com.gemstone.gemfire.internal.offheap.annotations.Unretained;
@@ -240,7 +240,7 @@ public interface RegionEntry {
* Obtain and return the value of this entry using {@link #_getValue()}.
* If the value is a MemoryChunkWithRefCount then increment its refcount.
* WARNING: if a MemoryChunkWithRefCount is returned then the caller MUST
- * call {@link MemoryChunkWithRefCount#release()}.
+ * call {@link ObjectStoredOffHeap#release()}.
*
* This is only retained in off-heap subclasses. However, it's marked as
* Retained here so that callers are aware that the value may be retained.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/MemoryAllocator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/MemoryAllocator.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/MemoryAllocator.java
index f008a5e..d06eb21 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/MemoryAllocator.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/MemoryAllocator.java
@@ -29,7 +29,7 @@ public interface MemoryAllocator {
* @return the allocated chunk of memory.
* @throws IllegalStateException if the heap does not have enough memory to grant the request
*/
- public MemoryChunkWithRefCount allocate(int size);
+ public ObjectStoredOffHeap allocate(int size);
/**
* Allocates off heap memory for the given data and returns a MemoryChunk
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/MemoryChunkWithRefCount.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/MemoryChunkWithRefCount.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/MemoryChunkWithRefCount.java
deleted file mode 100644
index e726433..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/MemoryChunkWithRefCount.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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;
-
-/**
- * Represents a chunk of allocated memory that is not on the heap.
- * This interface provides methods that let you read and write to the chunk.
- * A reference count is used to determine if the chunk is still allocated.
- * To increment the count call {@link #retain()}.
- * To decrement the count call {@link #release()}.
- *
- * @author darrel
- * @since 9.0
- */
-public interface MemoryChunkWithRefCount extends StoredObject {
-
- /**
- * Returns the size of this memory chunk in bytes.
- */
- public int getSize();
-
- public byte readByte(int offset);
- public void writeByte(int offset, byte value);
-
- public void readBytes(int offset, byte[] bytes);
- public void writeBytes(int offset, byte[] bytes);
- public void readBytes(int offset, byte[] bytes, int bytesOffset, int size);
- public void writeBytes(int offset, byte[] bytes, int bytesOffset, int size);
-
- /**
- * Read the bytes in this range [src..src+size]
- * and write them to the range that starts at dst.
- * The number of bytes copied is size.
- */
- public void copyBytes(int src, int dst, int size);
-
- /**
- * Returns the number of users of this memory.
- */
- public int getRefCount();
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/ObjectChunk.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/ObjectChunk.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/ObjectChunk.java
index 7e96763..4772f41 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/ObjectChunk.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/ObjectChunk.java
@@ -43,7 +43,7 @@ import com.gemstone.gemfire.internal.offheap.annotations.Unretained;
* to it in the cache. Instead the memoryAddress is stored in a primitive field in
* the cache and if used it will then, if needed, create an instance of this class.
*/
- public class ObjectChunk extends AbstractStoredObject implements MemoryChunkWithRefCount, Comparable<ObjectChunk>, MemoryBlock {
+ public class ObjectChunk extends AbstractStoredObject implements ObjectStoredOffHeap, Comparable<ObjectChunk>, MemoryBlock {
/**
* The unsafe memory address of the first byte of this chunk
*/
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/ObjectStoredOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/ObjectStoredOffHeap.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/ObjectStoredOffHeap.java
new file mode 100644
index 0000000..b7cfaab
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/ObjectStoredOffHeap.java
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+/**
+ * Represents a chunk of allocated memory that is not on the heap.
+ * This interface provides methods that let you read and write to the chunk.
+ * A reference count is used to determine if the chunk is still allocated.
+ * To increment the count call {@link #retain()}.
+ * To decrement the count call {@link #release()}.
+ *
+ * @author darrel
+ * @since 9.0
+ */
+public interface ObjectStoredOffHeap extends StoredObject {
+
+ /**
+ * Returns the size of this memory chunk in bytes.
+ */
+ public int getSize();
+
+ public byte readByte(int offset);
+ public void writeByte(int offset, byte value);
+
+ public void readBytes(int offset, byte[] bytes);
+ public void writeBytes(int offset, byte[] bytes);
+ public void readBytes(int offset, byte[] bytes, int bytesOffset, int size);
+ public void writeBytes(int offset, byte[] bytes, int bytesOffset, int size);
+
+ /**
+ * Read the bytes in this range [src..src+size]
+ * and write them to the range that starts at dst.
+ * The number of bytes copied is size.
+ */
+ public void copyBytes(int src, int dst, int size);
+
+ /**
+ * Returns the number of users of this memory.
+ */
+ public int getRefCount();
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapHelper.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapHelper.java
index 4845931..6a8783b 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapHelper.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapHelper.java
@@ -93,8 +93,8 @@ public class OffHeapHelper {
* @return true if release was done
*/
public static boolean release(@Released Object o) {
- if (o instanceof MemoryChunkWithRefCount) {
- ((MemoryChunkWithRefCount) o).release();
+ if (o instanceof ObjectStoredOffHeap) {
+ ((ObjectStoredOffHeap) o).release();
return true;
} else {
return false;
@@ -105,9 +105,9 @@ public class OffHeapHelper {
* @return true if release was done
*/
public static boolean releaseWithNoTracking(@Released Object o) {
- if (o instanceof MemoryChunkWithRefCount) {
+ if (o instanceof ObjectStoredOffHeap) {
ReferenceCountHelper.skipRefCountTracking();
- ((MemoryChunkWithRefCount) o).release();
+ ((ObjectStoredOffHeap) o).release();
ReferenceCountHelper.unskipRefCountTracking();
return true;
} else {
@@ -120,9 +120,9 @@ public class OffHeapHelper {
* @return true if release was done
*/
public static boolean releaseAndTrackOwner(@Released final Object o, final Object owner) {
- if (o instanceof MemoryChunkWithRefCount) {
+ if (o instanceof ObjectStoredOffHeap) {
ReferenceCountHelper.setReferenceCountOwner(owner);
- ((MemoryChunkWithRefCount) o).release();
+ ((ObjectStoredOffHeap) o).release();
ReferenceCountHelper.setReferenceCountOwner(null);
return true;
} else {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionEntryHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionEntryHelper.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionEntryHelper.java
index b62d97a..7b7efd0 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionEntryHelper.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionEntryHelper.java
@@ -184,7 +184,7 @@ public class OffHeapRegionEntryHelper {
setValue(re, Token.REMOVED_PHASE2);
}
- public static void releaseEntry(@Unretained OffHeapRegionEntry re, @Released MemoryChunkWithRefCount expectedValue) {
+ public static void releaseEntry(@Unretained OffHeapRegionEntry re, @Released ObjectStoredOffHeap expectedValue) {
long oldAddress = objectToAddress(expectedValue);
final long newAddress = objectToAddress(Token.REMOVED_PHASE2);
if (re.setAddress(oldAddress, newAddress) || re.getAddress() != newAddress) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
index e257ffa..e59ce9d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
@@ -307,7 +307,7 @@ public class SimpleMemoryAllocatorImpl implements MemoryAllocator {
}
@Override
- public MemoryChunkWithRefCount allocate(int size) {
+ public ObjectStoredOffHeap allocate(int size) {
//System.out.println("allocating " + size);
ObjectChunk result = allocateChunk(size);
//("allocated off heap object of size " + size + " @" + Long.toHexString(result.getMemoryAddress()), true);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
index ce2b7c0..0a1253b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
@@ -110,7 +110,7 @@ import com.gemstone.gemfire.internal.cache.versions.RegionVersionVector;
import com.gemstone.gemfire.internal.cache.versions.VMRegionVersionVector;
import com.gemstone.gemfire.internal.cache.versions.VersionTag;
import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.offheap.MemoryChunkWithRefCount;
+import com.gemstone.gemfire.internal.offheap.ObjectStoredOffHeap;
import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
@@ -2004,7 +2004,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
LocalRegion reRegion;
reRegion = (LocalRegion) region;
RegionEntry re = reRegion.getRegionEntry(key2);
- MemoryChunkWithRefCount so = (MemoryChunkWithRefCount) re._getValue();
+ ObjectStoredOffHeap so = (ObjectStoredOffHeap) re._getValue();
assertEquals(1, so.getRefCount());
assertEquals(1, ma.getStats().getObjects());
}
@@ -2091,7 +2091,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertEquals(2, ma.getStats().getObjects());
LocalRegion reRegion;
reRegion = (LocalRegion) region;
- MemoryChunkWithRefCount so = (MemoryChunkWithRefCount) reRegion.getRegionEntry(key)._getValue();
+ ObjectStoredOffHeap so = (ObjectStoredOffHeap) reRegion.getRegionEntry(key)._getValue();
assertEquals(1, so.getRefCount());
}
}
@@ -2157,7 +2157,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertEquals(2, ma.getStats().getObjects());
LocalRegion reRegion;
reRegion = (LocalRegion) region;
- MemoryChunkWithRefCount so = (MemoryChunkWithRefCount) reRegion.getRegionEntry(key)._getValue();
+ ObjectStoredOffHeap so = (ObjectStoredOffHeap) reRegion.getRegionEntry(key)._getValue();
assertEquals(1, so.getRefCount());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java
index cad54c0..7acc2c9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java
@@ -53,7 +53,7 @@ public class MemoryBlockNodeJUnitTest {
new SlabImpl((int)OffHeapStorage.MIN_SLAB_SIZE),
new SlabImpl((int)OffHeapStorage.MIN_SLAB_SIZE * 2)
};
- private MemoryChunkWithRefCount storedObject = null;
+ private ObjectStoredOffHeap storedObject = null;
static {
ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
@@ -94,11 +94,11 @@ public class MemoryBlockNodeJUnitTest {
return Long.valueOf(Long.MAX_VALUE);
}
- protected MemoryChunkWithRefCount createValueAsUnserializedStoredObject(Object value) {
- MemoryChunkWithRefCount createdObject = createValueAsUnserializedStoredObject(value, false);
+ protected ObjectStoredOffHeap createValueAsUnserializedStoredObject(Object value) {
+ ObjectStoredOffHeap createdObject = createValueAsUnserializedStoredObject(value, false);
return createdObject;
}
- protected MemoryChunkWithRefCount createValueAsUnserializedStoredObject(Object value, boolean isCompressed) {
+ protected ObjectStoredOffHeap createValueAsUnserializedStoredObject(Object value, boolean isCompressed) {
byte[] valueInByteArray;
if (value instanceof Long) {
valueInByteArray = convertValueToByteArray(value);
@@ -108,7 +108,7 @@ public class MemoryBlockNodeJUnitTest {
boolean isSerialized = false;
- MemoryChunkWithRefCount createdObject = createChunk(valueInByteArray, isSerialized, isCompressed);
+ ObjectStoredOffHeap createdObject = createChunk(valueInByteArray, isSerialized, isCompressed);
return createdObject;
}
@@ -116,23 +116,23 @@ public class MemoryBlockNodeJUnitTest {
return ByteBuffer.allocate(Long.SIZE / Byte.SIZE).putLong((Long) value).array();
}
- private MemoryChunkWithRefCount createChunk(byte[] v, boolean isSerialized, boolean isCompressed) {
- MemoryChunkWithRefCount chunk = (MemoryChunkWithRefCount) ma.allocateAndInitialize(v, isSerialized, isCompressed);
+ private ObjectStoredOffHeap createChunk(byte[] v, boolean isSerialized, boolean isCompressed) {
+ ObjectStoredOffHeap chunk = (ObjectStoredOffHeap) ma.allocateAndInitialize(v, isSerialized, isCompressed);
return chunk;
}
- protected MemoryChunkWithRefCount createValueAsSerializedStoredObject(Object value) {
- MemoryChunkWithRefCount createdObject = createValueAsSerializedStoredObject(value, false);
+ protected ObjectStoredOffHeap createValueAsSerializedStoredObject(Object value) {
+ ObjectStoredOffHeap createdObject = createValueAsSerializedStoredObject(value, false);
return createdObject;
}
- protected MemoryChunkWithRefCount createValueAsSerializedStoredObject(Object value, boolean isCompressed) {
+ protected ObjectStoredOffHeap createValueAsSerializedStoredObject(Object value, boolean isCompressed) {
byte[] valueInSerializedByteArray = EntryEventImpl.serialize(value);
boolean isSerialized = true;
- MemoryChunkWithRefCount createdObject = createChunk(valueInSerializedByteArray, isSerialized, isCompressed);
+ ObjectStoredOffHeap createdObject = createChunk(valueInSerializedByteArray, isSerialized, isCompressed);
return createdObject;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapHelperJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapHelperJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapHelperJUnitTest.java
index b1e3af0..0f6905b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapHelperJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapHelperJUnitTest.java
@@ -38,7 +38,7 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class OffHeapHelperJUnitTest extends AbstractStoredObjectTestBase {
- private MemoryChunkWithRefCount storedObject = null;
+ private ObjectStoredOffHeap storedObject = null;
private Object deserializedRegionEntryValue = null;
private byte[] serializedRegionEntryValue = null;
private MemoryAllocator ma;
@@ -102,7 +102,7 @@ public class OffHeapHelperJUnitTest extends AbstractStoredObjectTestBase {
}
@Override
- protected MemoryChunkWithRefCount createValueAsUnserializedStoredObject(Object value) {
+ protected ObjectStoredOffHeap createValueAsUnserializedStoredObject(Object value) {
byte[] valueInByteArray;
if (value instanceof Long) {
valueInByteArray = convertValueToByteArray(value);
@@ -113,18 +113,18 @@ public class OffHeapHelperJUnitTest extends AbstractStoredObjectTestBase {
boolean isSerialized = false;
boolean isCompressed = false;
- MemoryChunkWithRefCount createdObject = createChunk(valueInByteArray, isSerialized, isCompressed);
+ ObjectStoredOffHeap createdObject = createChunk(valueInByteArray, isSerialized, isCompressed);
return createdObject;
}
@Override
- protected MemoryChunkWithRefCount createValueAsSerializedStoredObject(Object value) {
+ protected ObjectStoredOffHeap createValueAsSerializedStoredObject(Object value) {
byte[] valueInSerializedByteArray = EntryEventImpl.serialize(value);
boolean isSerialized = true;
boolean isCompressed = false;
- MemoryChunkWithRefCount createdObject = createChunk(valueInSerializedByteArray, isSerialized, isCompressed);
+ ObjectStoredOffHeap createdObject = createChunk(valueInSerializedByteArray, isSerialized, isCompressed);
return createdObject;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java
index 3412afb..321446b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java
@@ -163,7 +163,7 @@ public abstract class OffHeapRegionBase {
final long offHeapSize = ma.getFreeMemory();
assertEquals(0, ma.getUsedMemory());
byte[] data = new byte[] {1,2,3,4,5,6,7,8};
- MemoryChunkWithRefCount mc1 = (MemoryChunkWithRefCount)ma.allocateAndInitialize(data, false, false);
+ ObjectStoredOffHeap mc1 = (ObjectStoredOffHeap)ma.allocateAndInitialize(data, false, false);
assertEquals(data.length+perObjectOverhead(), ma.getUsedMemory());
assertEquals(offHeapSize-(data.length+perObjectOverhead()), ma.getFreeMemory());
byte[] data2 = new byte[data.length];
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/723612d3/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
index 1cbb19b..5ff6b17 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
@@ -202,10 +202,10 @@ public class SimpleMemoryAllocatorJUnitTest {
assertEquals(TOTAL_MEM, ma.freeList.getFreeFragmentMemory());
assertEquals(0, ma.freeList.getFreeTinyMemory());
assertEquals(0, ma.freeList.getFreeHugeMemory());
- MemoryChunkWithRefCount tinymc = ma.allocate(maxTiny);
+ ObjectStoredOffHeap tinymc = ma.allocate(maxTiny);
assertEquals(TOTAL_MEM-round(TINY_MULTIPLE, maxTiny+perObjectOverhead), ma.getFreeMemory());
assertEquals(round(TINY_MULTIPLE, maxTiny+perObjectOverhead)*(BATCH_SIZE-1), ma.freeList.getFreeTinyMemory());
- MemoryChunkWithRefCount hugemc = ma.allocate(minHuge);
+ ObjectStoredOffHeap hugemc = ma.allocate(minHuge);
assertEquals(TOTAL_MEM-round(TINY_MULTIPLE, minHuge+perObjectOverhead)/*-round(BIG_MULTIPLE, maxBig+perObjectOverhead)*/-round(TINY_MULTIPLE, maxTiny+perObjectOverhead), ma.getFreeMemory());
long freeSlab = ma.freeList.getFreeFragmentMemory();
long oldFreeHugeMemory = ma.freeList.getFreeHugeMemory();
@@ -249,7 +249,7 @@ public class SimpleMemoryAllocatorJUnitTest {
hugemc = ma.allocate(minHuge);
assertEquals(round(TINY_MULTIPLE, minHuge+perObjectOverhead)*(BATCH_SIZE-1), ma.freeList.getFreeHugeMemory());
if (BATCH_SIZE > 1) {
- MemoryChunkWithRefCount hugemc2 = ma.allocate(minHuge);
+ ObjectStoredOffHeap hugemc2 = ma.allocate(minHuge);
assertEquals(round(TINY_MULTIPLE, minHuge+perObjectOverhead)*(BATCH_SIZE-2), ma.freeList.getFreeHugeMemory());
hugemc2.release();
assertEquals(round(TINY_MULTIPLE, minHuge+perObjectOverhead)*(BATCH_SIZE-1), ma.freeList.getFreeHugeMemory());
@@ -434,16 +434,16 @@ public class SimpleMemoryAllocatorJUnitTest {
SlabImpl slab = new SlabImpl(TOTAL_MEM);
try {
SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
- MemoryChunkWithRefCount bmc = ma.allocate(BIG_ALLOC_SIZE-perObjectOverhead);
+ ObjectStoredOffHeap bmc = ma.allocate(BIG_ALLOC_SIZE-perObjectOverhead);
try {
- MemoryChunkWithRefCount smc = ma.allocate(SMALL_ALLOC_SIZE-perObjectOverhead);
+ ObjectStoredOffHeap smc = ma.allocate(SMALL_ALLOC_SIZE-perObjectOverhead);
fail("Expected out of memory");
} catch (OutOfOffHeapMemoryException expected) {
}
bmc.release();
assertEquals(TOTAL_MEM, ma.freeList.getFreeMemory());
- MemoryChunkWithRefCount smc1 = ma.allocate(SMALL_ALLOC_SIZE-perObjectOverhead);
- MemoryChunkWithRefCount smc2 = ma.allocate(SMALL_ALLOC_SIZE-perObjectOverhead);
+ ObjectStoredOffHeap smc1 = ma.allocate(SMALL_ALLOC_SIZE-perObjectOverhead);
+ ObjectStoredOffHeap smc2 = ma.allocate(SMALL_ALLOC_SIZE-perObjectOverhead);
smc2.release();
assertEquals(TOTAL_MEM-SMALL_ALLOC_SIZE, ma.freeList.getFreeMemory());
try {
@@ -456,7 +456,7 @@ public class SimpleMemoryAllocatorJUnitTest {
bmc = ma.allocate(BIG_ALLOC_SIZE-perObjectOverhead);
bmc.release();
assertEquals(TOTAL_MEM, ma.freeList.getFreeMemory());
- ArrayList<MemoryChunkWithRefCount> mcs = new ArrayList<MemoryChunkWithRefCount>();
+ ArrayList<ObjectStoredOffHeap> mcs = new ArrayList<ObjectStoredOffHeap>();
for (int i=0; i < BIG_ALLOC_SIZE/(8+perObjectOverhead); i++) {
mcs.add(ma.allocate(8));
}
@@ -492,11 +492,11 @@ public class SimpleMemoryAllocatorJUnitTest {
assertEquals((8+perObjectOverhead)*6, ma.freeList.getFreeMemory());
checkMcs(mcs);
// At this point I should have 8*6 + perObjectOverhead*6 of free memory
- MemoryChunkWithRefCount mc24 = ma.allocate(24);
+ ObjectStoredOffHeap mc24 = ma.allocate(24);
checkMcs(mcs);
assertEquals((8+perObjectOverhead)*6 - (24+perObjectOverhead), ma.freeList.getFreeMemory());
// At this point I should have 8*3 + perObjectOverhead*5 of free memory
- MemoryChunkWithRefCount mc16 = ma.allocate(16);
+ ObjectStoredOffHeap mc16 = ma.allocate(16);
checkMcs(mcs);
assertEquals((8+perObjectOverhead)*6 - (24+perObjectOverhead) - (16+perObjectOverhead), ma.freeList.getFreeMemory());
// At this point I should have 8*1 + perObjectOverhead*4 of free memory
@@ -504,7 +504,7 @@ public class SimpleMemoryAllocatorJUnitTest {
checkMcs(mcs);
assertEquals((8+perObjectOverhead)*6 - (24+perObjectOverhead) - (16+perObjectOverhead) - (8+perObjectOverhead), ma.freeList.getFreeMemory());
// At this point I should have 8*0 + perObjectOverhead*3 of free memory
- MemoryChunkWithRefCount mcDO = ma.allocate(perObjectOverhead*2);
+ ObjectStoredOffHeap mcDO = ma.allocate(perObjectOverhead*2);
checkMcs(mcs);
// At this point I should have 8*0 + perObjectOverhead*0 of free memory
assertEquals(0, ma.freeList.getFreeMemory());
@@ -525,7 +525,7 @@ public class SimpleMemoryAllocatorJUnitTest {
assertEquals((perObjectOverhead*3)+(8+perObjectOverhead)+(16+perObjectOverhead)+(24+perObjectOverhead), ma.freeList.getFreeMemory());
long freeMem = ma.freeList.getFreeMemory();
- for (MemoryChunkWithRefCount mc: mcs) {
+ for (ObjectStoredOffHeap mc: mcs) {
mc.release();
assertEquals(freeMem+(8+perObjectOverhead), ma.freeList.getFreeMemory());
freeMem += (8+perObjectOverhead);
@@ -559,7 +559,7 @@ public class SimpleMemoryAllocatorJUnitTest {
this.expectedMemoryUsage = SMALL_ALLOC_SIZE;
this.memoryUsageEventReceived = false;
- MemoryChunkWithRefCount smc = ma.allocate(SMALL_ALLOC_SIZE-perObjectOverhead);
+ ObjectStoredOffHeap smc = ma.allocate(SMALL_ALLOC_SIZE-perObjectOverhead);
assertEquals(true, this.memoryUsageEventReceived);
this.expectedMemoryUsage = SMALL_ALLOC_SIZE * 2;
@@ -588,8 +588,8 @@ public class SimpleMemoryAllocatorJUnitTest {
SimpleMemoryAllocatorImpl.freeOffHeapMemory();
}
}
- private void checkMcs(ArrayList<MemoryChunkWithRefCount> mcs) {
- for (MemoryChunkWithRefCount mc: mcs) {
+ private void checkMcs(ArrayList<ObjectStoredOffHeap> mcs) {
+ for (ObjectStoredOffHeap mc: mcs) {
assertEquals(8+8, mc.getSize());
}
}
@@ -614,11 +614,11 @@ public class SimpleMemoryAllocatorJUnitTest {
try {
SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(oooml, new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
// make a big allocation
- MemoryChunkWithRefCount bmc = ma.allocate(BIG_ALLOC_SIZE-perObjectOverhead);
+ ObjectStoredOffHeap bmc = ma.allocate(BIG_ALLOC_SIZE-perObjectOverhead);
assertNull(ooom.get());
// drive the ma to ooom with small allocations
try {
- MemoryChunkWithRefCount smc = ma.allocate(SMALL_ALLOC_SIZE-perObjectOverhead);
+ ObjectStoredOffHeap smc = ma.allocate(SMALL_ALLOC_SIZE-perObjectOverhead);
fail("Expected out of memory");
} catch (OutOfOffHeapMemoryException expected) {
}