コード例 #1
0
  @Test(timeout = 120000)
  public void testMapCreation__notAffectedByUnresponsiveLoader() throws Exception {
    final UnresponsiveLoader unresponsiveLoader = new UnresponsiveLoader<Integer, Integer>();
    final IMap map =
        TestMapUsingMapStoreBuilder.create()
            .withMapStore(unresponsiveLoader)
            .withNodeCount(1)
            .withNodeFactory(createHazelcastInstanceFactory(1))
            .withPartitionCount(1)
            .build();

    final LocalMapStats stats = map.getLocalMapStats();
    final long ownedEntryCount = stats.getOwnedEntryCount();

    assertEquals(0, ownedEntryCount);
  }
コード例 #2
0
  @Test
  public void testGetAll_putsLoadedItemsToIMap() throws Exception {
    Integer[] requestedKeys = {1, 2, 3};
    AtomicInteger loadedKeysCounter = new AtomicInteger(0);
    MapStore<Integer, Integer> mapStore = createMapLoader(loadedKeysCounter);

    IMap<Integer, Integer> map =
        TestMapUsingMapStoreBuilder.<Integer, Integer>create()
            .withMapStore(mapStore)
            .withNodeCount(1)
            .withNodeFactory(createHazelcastInstanceFactory(1))
            .withPartitionCount(1)
            .build();

    Set<Integer> keySet = new HashSet<Integer>(Arrays.asList(requestedKeys));

    map.getAll(keySet);
    map.getAll(keySet);
    map.getAll(keySet);

    assertEquals(requestedKeys.length, loadedKeysCounter.get());
  }