GEODE-266: Remove the deprecated ObjectSizerImpl class This closes #469 Signed-off-by: adongre <adon...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/4d384113 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/4d384113 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/4d384113 Branch: refs/heads/feature/GEM-1299 Commit: 4d3841131c9c03f1b252107803520207ea8cd1d9 Parents: a3434e2 Author: adongre <adon...@apache.org> Authored: Tue Apr 11 16:06:47 2017 +0530 Committer: adongre <adon...@apache.org> Committed: Wed Apr 26 17:50:19 2017 +0530 ---------------------------------------------------------------------- .../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/4d384113/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/4d384113/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/4d384113/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/4d384113/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); }