Skip to content
Permalink
Browse files
revert changes to MemoryCleaner and its test.
  • Loading branch information
leerho committed Aug 17, 2021
1 parent 5a46c35 commit c7417238aadc1760c6b10efe23fb7ac72c940302
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
@@ -19,28 +19,32 @@

package org.apache.datasketches.memory.test;

import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

import java.util.concurrent.atomic.AtomicBoolean;

//import org.apache.datasketches.memory.internal.MemoryCleaner;
import org.apache.datasketches.memory.internal.MemoryCleaner;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class MemoryCleanerTest {

// @Test
// public void cleanerDeallocates() {
// SimpleDeallocator deallocator = new SimpleDeallocator();
// MemoryCleaner cleaner = new MemoryCleaner(this, deallocator);
// cleaner.clean();
// assertTrue(SimpleDeallocator.getHasRun());
// }
//
// @SuppressWarnings("unused")
// @Test
// public void noDeallocation() {
// SimpleDeallocator deallocator = new SimpleDeallocator();
// new MemoryCleaner(this, deallocator);
// assertFalse(SimpleDeallocator.getHasRun());
// }
@Test
public void cleanerDeallocates() {
SimpleDeallocator deallocator = new SimpleDeallocator();
MemoryCleaner cleaner = new MemoryCleaner(this, deallocator);
cleaner.clean();
assertTrue(SimpleDeallocator.getHasRun());
}

@SuppressWarnings("unused")
@Test
public void noDeallocation() {
SimpleDeallocator deallocator = new SimpleDeallocator();
new MemoryCleaner(this, deallocator);
assertFalse(SimpleDeallocator.getHasRun());
}

static final class SimpleDeallocator implements Runnable {
static final AtomicBoolean hasRun = new AtomicBoolean();
@@ -29,7 +29,7 @@
* For more information, see: https://openjdk.java.net/jeps/238
*/
@SuppressWarnings("restriction")
class MemoryCleaner {
public class MemoryCleaner {
private final Cleaner cleaner;

/**

0 comments on commit c741723

Please sign in to comment.