Java Code Examples for java.util.concurrent.ConcurrentNavigableMap#clear()

The following examples show how to use java.util.concurrent.ConcurrentNavigableMap#clear() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemoryRawKVStore.java    From sofa-jraft with Apache License 2.0 6 votes vote down vote up
@Override
public void deleteRange(final byte[] startKey, final byte[] endKey, final KVStoreClosure closure) {
    final Timer.Context timeCtx = getTimeContext("DELETE_RANGE");
    try {
        final ConcurrentNavigableMap<byte[], byte[]> subMap = this.defaultDB.subMap(startKey, endKey);
        if (!subMap.isEmpty()) {
            subMap.clear();
        }
        setSuccess(closure, Boolean.TRUE);
    } catch (final Exception e) {
        LOG.error("Fail to [DELETE_RANGE], ['[{}, {})'], {}.", BytesUtil.toHex(startKey), BytesUtil.toHex(endKey),
            StackTraceUtil.stackTrace(e));
        setCriticalError(closure, "Fail to [DELETE_RANGE]", e);
    } finally {
        timeCtx.stop();
    }
}
 
Example 2
Source File: ConcurrentSkipListSubMapTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Maps with same contents are equal
 */
public void testDescendingEquals() {
    ConcurrentNavigableMap map1 = dmap5();
    ConcurrentNavigableMap map2 = dmap5();
    assertEquals(map1, map2);
    assertEquals(map2, map1);
    map1.clear();
    assertFalse(map1.equals(map2));
    assertFalse(map2.equals(map1));
}
 
Example 3
Source File: ConcurrentSkipListSubMapTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps with same contents are equal
 */
public void testEquals() {
    ConcurrentNavigableMap map1 = map5();
    ConcurrentNavigableMap map2 = map5();
    assertEquals(map1, map2);
    assertEquals(map2, map1);
    map1.clear();
    assertFalse(map1.equals(map2));
    assertFalse(map2.equals(map1));
}
 
Example 4
Source File: ConcurrentSkipListSubMapTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps with same contents are equal
 */
public void testDescendingEquals() {
    ConcurrentNavigableMap map1 = dmap5();
    ConcurrentNavigableMap map2 = dmap5();
    assertEquals(map1, map2);
    assertEquals(map2, map1);
    map1.clear();
    assertFalse(map1.equals(map2));
    assertFalse(map2.equals(map1));
}
 
Example 5
Source File: ConcurrentSkipListSubMapTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Maps with same contents are equal
 */
public void testEquals() {
    ConcurrentNavigableMap map1 = map5();
    ConcurrentNavigableMap map2 = map5();
    assertEquals(map1, map2);
    assertEquals(map2, map1);
    map1.clear();
    assertFalse(map1.equals(map2));
    assertFalse(map2.equals(map1));
}
 
Example 6
Source File: BTreeMapTest5.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Maps with same contents are equal
 */
public void testEquals() {
    ConcurrentNavigableMap map1 = map5();
    ConcurrentNavigableMap map2 = map5();
    assertEquals(map1, map2);
    assertEquals(map2, map1);
    map1.clear();
    assertFalse(map1.equals(map2));
    assertFalse(map2.equals(map1));
}
 
Example 7
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Maps with same contents are equal
 */
public void testEquals() {
    ConcurrentNavigableMap map1 = map5();
    ConcurrentNavigableMap map2 = map5();
    assertEquals(map1, map2);
    assertEquals(map2, map1);
    map1.clear();
    assertFalse(map1.equals(map2));
    assertFalse(map2.equals(map1));
}
 
Example 8
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Maps with same contents are equal
 */
public void testDescendingEquals() {
    ConcurrentNavigableMap map1 = dmap5();
    ConcurrentNavigableMap map2 = dmap5();
    assertEquals(map1, map2);
    assertEquals(map2, map1);
    map1.clear();
    assertFalse(map1.equals(map2));
    assertFalse(map2.equals(map1));
}
 
Example 9
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Maps with same contents are equal
 */
public void testDescendingEquals() {
    ConcurrentNavigableMap map1 = dmap5();
    ConcurrentNavigableMap map2 = dmap5();
    assertEquals(map1, map2);
    assertEquals(map2, map1);
    map1.clear();
    assertFalse(map1.equals(map2));
    assertFalse(map2.equals(map1));
}
 
Example 10
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Maps with same contents are equal
 */
public void testEquals() {
    ConcurrentNavigableMap map1 = map5();
    ConcurrentNavigableMap map2 = map5();
    assertEquals(map1, map2);
    assertEquals(map2, map1);
    map1.clear();
    assertFalse(map1.equals(map2));
    assertFalse(map2.equals(map1));
}
 
Example 11
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * clear removes all pairs
 */
public void testDescendingClear() {
    ConcurrentNavigableMap map = dmap5();
    map.clear();
    assertEquals(0, map.size());
}
 
Example 12
Source File: ConcurrentSkipListSubMapTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * clear removes all pairs
 */
public void testDescendingClear() {
    ConcurrentNavigableMap map = dmap5();
    map.clear();
    assertEquals(0, map.size());
}
 
Example 13
Source File: ConcurrentSkipListSubMapTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * clear removes all pairs
 */
public void testClear() {
    ConcurrentNavigableMap map = map5();
    map.clear();
    assertEquals(0, map.size());
}
 
Example 14
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * clear removes all pairs
 */
public void testDescendingClear() {
    ConcurrentNavigableMap map = dmap5();
    map.clear();
    assertEquals(0, map.size());
}
 
Example 15
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * clear removes all pairs
 */
public void testClear() {
    ConcurrentNavigableMap map = map5();
    map.clear();
    assertEquals(0, map.size());
}
 
Example 16
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * clear removes all pairs
 */
public void testClear() {
    ConcurrentNavigableMap map = map5();
    map.clear();
    assertEquals(0, map.size());
}
 
Example 17
Source File: BTreeMapTest5.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * clear removes all pairs
 */
public void testClear() {
    ConcurrentNavigableMap map = map5();
    map.clear();
    assertEquals(0, map.size());
}
 
Example 18
Source File: ConcurrentSkipListSubMapTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * clear removes all pairs
 */
public void testDescendingClear() {
    ConcurrentNavigableMap map = dmap5();
    map.clear();
    assertEquals(0, map.size());
}
 
Example 19
Source File: ConcurrentSkipListSubMapTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * clear removes all pairs
 */
public void testClear() {
    ConcurrentNavigableMap map = map5();
    map.clear();
    assertEquals(0, map.size());
}