You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by zh...@apache.org on 2017/04/27 17:24:45 UTC
[15/26] geode git commit: GEODE-266: Remove the deprecated
ObjectSizerImpl class This closes #469
GEODE-266: Remove the deprecated ObjectSizerImpl class
This closes #469
Signed-off-by: adongre <ad...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/c861065d
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/c861065d
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/c861065d
Branch: refs/heads/feature/GEM-1299
Commit: c861065d617701962473197d011db2255cbe6cba
Parents: d30aabb
Author: adongre <ad...@apache.org>
Authored: Tue Apr 11 16:06:47 2017 +0530
Committer: zhouxh <gz...@pivotal.io>
Committed: Wed Apr 26 23:28:49 2017 -0700
----------------------------------------------------------------------
.../geode/cache/util/ObjectSizerImpl.java | 31 --------------------
.../internal/cache/EvictionStatsDUnitTest.java | 4 +--
.../geode/internal/cache/EvictionTestBase.java | 8 ++---
.../PartitionedRegionEvictionDUnitTest.java | 8 ++---
4 files changed, 10 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/c861065d/geode-core/src/main/java/org/apache/geode/cache/util/ObjectSizerImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/util/ObjectSizerImpl.java b/geode-core/src/main/java/org/apache/geode/cache/util/ObjectSizerImpl.java
deleted file mode 100755
index 818accf..0000000
--- a/geode-core/src/main/java/org/apache/geode/cache/util/ObjectSizerImpl.java
+++ /dev/null
@@ -1,31 +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 org.apache.geode.cache.util;
-
-/**
- * This class provides an implementation of the ObjectSizer interface. This uses a helper class to
- * provide the size of an object. The implementation uses reflection to compute object size. This is
- * to be used for testing purposes only This implementation is slow and may cause throughput numbers
- * to drop if used on complex objects.
- *
- *
- * @deprecated use {@link ObjectSizer#DEFAULT} instead.
- */
-public class ObjectSizerImpl implements ObjectSizer {
-
- public int sizeof(Object o) {
- return ObjectSizer.DEFAULT.sizeof(o);
- }
-}
http://git-wip-us.apache.org/repos/asf/geode/blob/c861065d/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionStatsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionStatsDUnitTest.java
index 11efd53..9a7591c 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionStatsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionStatsDUnitTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.internal.cache;
+import org.apache.geode.cache.util.ObjectSizer;
import org.apache.geode.test.dunit.IgnoredException;
import org.junit.experimental.categories.Category;
import org.junit.Test;
@@ -38,7 +39,6 @@ import org.apache.geode.cache.EvictionAlgorithm;
import org.apache.geode.cache.EvictionAttributes;
import org.apache.geode.cache.PartitionAttributesFactory;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.util.ObjectSizerImpl;
import org.apache.geode.cache30.CacheSerializableRunnable;
import org.apache.geode.cache30.CacheTestCase;
import org.apache.geode.distributed.DistributedSystem;
@@ -482,7 +482,7 @@ public class EvictionStatsDUnitTest extends JUnit4CacheTestCase {
evictionAction == 1 ? EvictionAction.LOCAL_DESTROY : EvictionAction.OVERFLOW_TO_DISK));
} else if (evictionAlgorithm.isLRUMemory()) {
factory.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(maxSizeInMb,
- new ObjectSizerImpl(),
+ ObjectSizer.DEFAULT,
evictionAction == 1 ? EvictionAction.LOCAL_DESTROY : EvictionAction.OVERFLOW_TO_DISK));
} else {
factory.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(maxEnteries,
http://git-wip-us.apache.org/repos/asf/geode/blob/c861065d/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionTestBase.java b/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionTestBase.java
index fe86910..a0f7af5 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionTestBase.java
@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import org.apache.geode.cache.util.ObjectSizer;
import org.junit.experimental.categories.Category;
import org.apache.geode.cache.AttributesFactory;
@@ -35,7 +36,6 @@ import org.apache.geode.cache.EvictionAlgorithm;
import org.apache.geode.cache.EvictionAttributes;
import org.apache.geode.cache.PartitionAttributesFactory;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.util.ObjectSizerImpl;
import org.apache.geode.cache30.CacheSerializableRunnable;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.internal.DistributionConfig;
@@ -231,8 +231,8 @@ public class EvictionTestBase extends JUnit4CacheTestCase {
public static void createDistRegionWithMemEvictionAttr() {
final AttributesFactory factory = new AttributesFactory();
factory.setDataPolicy(DataPolicy.NORMAL);
- factory.setEvictionAttributes(EvictionAttributes
- .createLRUMemoryAttributes(new ObjectSizerImpl(), EvictionAction.LOCAL_DESTROY));
+ factory.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(ObjectSizer.DEFAULT,
+ EvictionAction.LOCAL_DESTROY));
DistributedRegion distRegion = (DistributedRegion) cache.createRegion("DR1", factory.create());
assertNotNull(distRegion);
@@ -330,7 +330,7 @@ public class EvictionTestBase extends JUnit4CacheTestCase {
} else if (evictionAlgorithm.isLRUMemory()) {
factory.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(
- new ObjectSizerImpl(),
+ ObjectSizer.DEFAULT,
evictionAction == 1 ? EvictionAction.LOCAL_DESTROY : EvictionAction.OVERFLOW_TO_DISK));
} else {
factory.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(maxEnteries,
http://git-wip-us.apache.org/repos/asf/geode/blob/c861065d/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionEvictionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionEvictionDUnitTest.java
index 82108b0..0c9b02f 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionEvictionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionEvictionDUnitTest.java
@@ -22,6 +22,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
+import org.apache.geode.cache.util.ObjectSizer;
import org.apache.geode.test.dunit.IgnoredException;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -42,7 +43,6 @@ import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.cache.SubscriptionAttributes;
import org.apache.geode.cache.util.CacheListenerAdapter;
-import org.apache.geode.cache.util.ObjectSizerImpl;
import org.apache.geode.cache30.CacheSerializableRunnable;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.OSProcess;
@@ -349,8 +349,8 @@ public class PartitionedRegionEvictionDUnitTest extends JUnit4CacheTestCase {
new PartitionAttributesFactory().setRedundantCopies(redundantCopies)
.setLocalMaxMemory(localMaxMem).setTotalNumBuckets(maxBuckets).create());
- factory.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(
- new ObjectSizerImpl(), EvictionAction.OVERFLOW_TO_DISK));
+ factory.setEvictionAttributes(EvictionAttributes
+ .createLRUMemoryAttributes(ObjectSizer.DEFAULT, EvictionAction.OVERFLOW_TO_DISK));
factory.setDiskSynchronous(true);
DiskStoreFactory dsf = getCache().createDiskStoreFactory();
final File[] diskDirs = new File[1];
@@ -452,7 +452,7 @@ public class PartitionedRegionEvictionDUnitTest extends JUnit4CacheTestCase {
new PartitionAttributesFactory().setRedundantCopies(redundantCopies)
.setLocalMaxMemory(16).setTotalNumBuckets(maxBuckets).create());
factory.setEvictionAttributes(EvictionAttributes
- .createLRUMemoryAttributes(new ObjectSizerImpl(), EvictionAction.LOCAL_DESTROY));
+ .createLRUMemoryAttributes(ObjectSizer.DEFAULT, EvictionAction.LOCAL_DESTROY));
final PartitionedRegion pr = (PartitionedRegion) createRootRegion(name, factory.create());
assertNotNull(pr);
}