forked from apache/geode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GEODE-4712 GEODE-5943: shut down the bucketSorter when destroying the…
… partitioned region (apache#2845)
- Loading branch information
1 parent
c39030a
commit 3f4474c
Showing
4 changed files
with
67 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...ntegrationTest/java/org/apache/geode/internal/cache/PartitionedRegionIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.apache.geode.internal.cache; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.concurrent.ScheduledExecutorService; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
import org.apache.geode.cache.EvictionAction; | ||
import org.apache.geode.cache.EvictionAttributes; | ||
import org.apache.geode.cache.RegionShortcut; | ||
import org.apache.geode.test.junit.rules.ServerStarterRule; | ||
|
||
public class PartitionedRegionIntegrationTest { | ||
|
||
@Rule | ||
public ServerStarterRule server = new ServerStarterRule().withNoCacheServer().withAutoStart(); | ||
|
||
@Test | ||
public void bucketSorterShutdownAfterRegionDestroy() { | ||
PartitionedRegion region = | ||
(PartitionedRegion) server.createRegion(RegionShortcut.PARTITION, "PR1", | ||
f -> f.setEvictionAttributes( | ||
EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.LOCAL_DESTROY))); | ||
|
||
ScheduledExecutorService bucketSorter = region.getBucketSorter(); | ||
assertThat(bucketSorter).isNotNull(); | ||
|
||
region.destroyRegion(); | ||
|
||
assertThat(bucketSorter.isShutdown()).isTrue(); | ||
} | ||
|
||
@Test | ||
public void bucketSorterIsNotCreatedIfNoEviction() { | ||
PartitionedRegion region = | ||
(PartitionedRegion) server.createRegion(RegionShortcut.PARTITION, "PR1", | ||
rf -> rf.setOffHeap(false)); | ||
ScheduledExecutorService bucketSorter = region.getBucketSorter(); | ||
assertThat(bucketSorter).isNull(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters