com.hazelcast.core.MultiMap.keySet()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中com.hazelcast.core.MultiMap.keySet()方法的一些代码示例,展示了MultiMap.keySet()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MultiMap.keySet()方法的具体详情如下:
包路径:com.hazelcast.core.MultiMap
类名称:MultiMap
方法名:keySet

MultiMap.keySet介绍

[英]Returns the set of keys in the multimap.

Warning: The collection is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa.
[中]返回多重映射中的键集。
警告:集合不受映射支持,因此对映射的更改不会反映在集合中,反之亦然。

代码示例

代码示例来源:origin: FlavioF/quartz-scheduler-hazelcast-jobstore

@Override
public List<String> getJobGroupNames()
 throws JobPersistenceException {
 return newArrayList(jobsByGroup.keySet());
}

代码示例来源:origin: FlavioF/quartz-scheduler-hazelcast-jobstore

@Override
public List<String> getTriggerGroupNames()
 throws JobPersistenceException {
 return new LinkedList<>(triggersByGroup.keySet());
}

代码示例来源:origin: jclawson/hazeltask

public Set<K> keySet() {
  if(guavaMultiMap != null) {
    synchronized (guavaMultiMap) {
      Set<K> c = guavaMultiMap.keySet();
      if(c != null)
        return new HashSet<K>(c);
      else
        return null;
    }
  }
  return hcMultiMap.keySet();
}

代码示例来源:origin: org.opendaylight.nic/intent-mapping-hazelcast

@Override
public Collection<String> keys() {
  return getMultiMap().keySet();
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

public static void main(String[] args) {
    HazelcastInstance hz = Hazelcast.newHazelcastInstance();
    MultiMap<String, String> map = hz.getMultiMap("map");
    for (String key : map.keySet()) {
      Collection<String> values = map.get(key);
      System.out.printf("%s -> %s\n", key, values);
    }
  }
}

代码示例来源:origin: com.thinkaurelius.titan/titan-hazelcast

@Override
public KeyIterator getKeys(final SliceQuery query, StoreTransaction txh) throws StorageException {
  final Iterator<byte[]> entries = Iterators.filter(cache.keySet().iterator(), new Predicate<byte[]>() {
    @Override
    public boolean apply(@Nullable byte[] rawKey) {
      Iterator<Column> columns = cache.get(rawKey).iterator();
      Optional<Column> hit = Iterators.tryFind(columns, new Predicate<Column>() {
        @Override
        public boolean apply(Column input) {
          StaticBuffer c = new StaticArrayBuffer(input.name);
          return c.compareTo(query.getSliceStart()) >= 0 && c.compareTo(query.getSliceEnd()) < 0;
        }
      });
      return hit.isPresent();
    }
  });
  
  return new HazelcatKeyIterator(entries, query);
}

代码示例来源:origin: hazelcast/hazelcast-jet

protected void handleMultiMapKeys() {
  Set set = getMultiMap().keySet();
  Iterator it = set.iterator();
  int count = 0;
  while (it.hasNext()) {
    count++;
    println(it.next());
  }
  println("Total " + count);
}

代码示例来源:origin: com.hazelcast/hazelcast-all

protected void handleMultiMapKeys() {
  Set set = getMultiMap().keySet();
  Iterator it = set.iterator();
  int count = 0;
  while (it.hasNext()) {
    count++;
    println(it.next());
  }
  println("Total " + count);
}

代码示例来源:origin: com.hazelcast/hazelcast-all

protected void handleMultiMapKeys() {
  Set set = getMultiMap().keySet();
  Iterator it = set.iterator();
  int count = 0;
  while (it.hasNext()) {
    count++;
    println(it.next());
  }
  println("Total " + count);
}

代码示例来源:origin: hazelcast/hazelcast-jet

protected void handleMultiMapKeys() {
  Set set = getMultiMap().keySet();
  Iterator it = set.iterator();
  int count = 0;
  while (it.hasNext()) {
    count++;
    println(it.next());
  }
  println("Total " + count);
}

代码示例来源:origin: com.thinkaurelius.titan/titan-hazelcast

@Override
public KeyIterator getKeys(final KeyRangeQuery query, StoreTransaction txh) throws StorageException {
  final Iterator<byte[]> entries = Iterators.filter(cache.keySet().iterator(), new Predicate<byte[]>() {
    @Override
    public boolean apply(@Nullable byte[] rawKey) {
      StaticBuffer key = new StaticArrayBuffer(rawKey);
      boolean acceptKey = key.compareTo(query.getKeyStart()) >= 0 && key.compareTo(query.getKeyEnd()) < 0;
      if (!acceptKey)
        return false;
      
      Iterator<Column> columns = cache.get(rawKey).iterator();
      Optional<Column> hit = Iterators.tryFind(columns, new Predicate<Column>() {
        @Override
        public boolean apply(Column input) {
          StaticBuffer c = new StaticArrayBuffer(input.name);
          return c.compareTo(query.getSliceStart()) >= 0 && c.compareTo(query.getSliceEnd()) < 0;
        }
      });
      return hit.isPresent();
    }
  });
  return new HazelcatKeyIterator(entries, query);
}

代码示例来源:origin: spring-projects/spring-integration-extensions

private boolean isEventComingFromNonRegisteredHazelcastInstance(
    final HazelcastInstance hazelcastInstance,
    final Set<SocketAddress> localSocketAddressesSet,
    final InetSocketAddress socketAddressOfEvent) {
  final MultiMap<SocketAddress, SocketAddress> configMultiMap = hazelcastInstance
      .getMultiMap(HazelcastLocalInstanceRegistrar.SPRING_INTEGRATION_INTERNAL_CLUSTER_MULTIMAP);
  return configMultiMap.size() > 0
      && !configMultiMap.values().contains(socketAddressOfEvent)
      && localSocketAddressesSet.contains(configMultiMap.keySet().iterator().next());
}

代码示例来源:origin: FlavioF/quartz-scheduler-hazelcast-jobstore

@Override
public void pauseAll()
 throws JobPersistenceException {
 for (String triggerGroup : triggersByGroup.keySet()) {
  pauseTriggers(GroupMatcher.triggerGroupEquals(triggerGroup));
 }
}

代码示例来源:origin: hazelcast/hazelcast-jet

it = getMap().keySet().iterator();
} else if (iteratorStr.startsWith("mm.")) {
  it = getMultiMap().keySet().iterator();
} else if (iteratorStr.startsWith("q.")) {
  it = getQueue().iterator();

代码示例来源:origin: spring-projects/spring-integration-extensions

private void syncConfigurationMultiMap(HazelcastInstance hazelcastInstance) {
  Lock lock = hazelcastInstance.getLock(SPRING_INTEGRATION_INTERNAL_CLUSTER_LOCK);
  lock.lock();
  try {
    MultiMap<SocketAddress, SocketAddress> multiMap = hazelcastInstance
        .getMultiMap(SPRING_INTEGRATION_INTERNAL_CLUSTER_MULTIMAP);
    for (HazelcastInstance localInstance : Hazelcast.getAllHazelcastInstances()) {
      SocketAddress localInstanceSocketAddress = localInstance.getLocalEndpoint().getSocketAddress();
      if (multiMap.size() == 0) {
        multiMap.put(localInstanceSocketAddress, localInstanceSocketAddress);
      }
      else {
        multiMap.put(multiMap.keySet().iterator().next(), localInstanceSocketAddress);
      }
    }
  }
  finally {
    lock.unlock();
  }
}

代码示例来源:origin: hazelcast/hazelcast-jet

it = getMap().keySet().iterator();
} else if (iteratorStr.startsWith("mm.")) {
  it = getMultiMap().keySet().iterator();
} else if (iteratorStr.startsWith("q.")) {
  it = getQueue().iterator();

代码示例来源:origin: spring-projects/spring-integration-extensions

configMultiMap.remove(configMultiMap.keySet().iterator().next(), removedMemberSocketAddress);

代码示例来源:origin: FlavioF/quartz-scheduler-hazelcast-jobstore

@Override
public Collection<String> pauseJobs(GroupMatcher<JobKey> groupMatcher)
 throws JobPersistenceException {
 List<String> pausedGroups = new LinkedList<>();
 StringMatcher.StringOperatorName operator = groupMatcher
   .getCompareWithOperator();
 switch (operator) {
  case EQUALS:
   if (pausedJobGroups.add(groupMatcher.getCompareToValue())) {
    pausedGroups.add(groupMatcher.getCompareToValue());
   }
   break;
  default:
   for (String jobGroup : jobsByGroup.keySet()) {
    if (operator.evaluate(jobGroup, groupMatcher.getCompareToValue())) {
     if (pausedJobGroups.add(jobGroup)) {
      pausedGroups.add(jobGroup);
     }
    }
   }
 }
 for (String groupName : pausedGroups) {
  for (JobKey jobKey : getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
   pauseJob(jobKey);
  }
 }
 return pausedGroups;
}

代码示例来源:origin: FlavioF/quartz-scheduler-hazelcast-jobstore

@Override
public Collection<String> pauseTriggers(GroupMatcher<TriggerKey> matcher)
 throws JobPersistenceException {
 List<String> pausedGroups = new LinkedList<>();
 StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
 switch (operator) {
  case EQUALS:
   if (pausedTriggerGroups.add(matcher.getCompareToValue())) {
    pausedGroups.add(matcher.getCompareToValue());
   }
   break;
  default:
   for (String group : triggersByGroup.keySet()) {
    if (operator.evaluate(group, matcher.getCompareToValue())) {
     if (pausedTriggerGroups.add(matcher.getCompareToValue())) {
      pausedGroups.add(group);
     }
    }
   }
 }
 for (String pausedGroup : pausedGroups) {
  Set<TriggerKey> keys = getTriggerKeys(GroupMatcher.triggerGroupEquals(pausedGroup));
  for (TriggerKey key : keys) {
   pauseTrigger(key);
  }
 }
 return pausedGroups;
}

代码示例来源:origin: spring-projects/spring-integration-extensions

private static void verifyMultiMapForPayload(
    final MultiMap<Integer, HazelcastIntegrationTestUser> multiMap) {
  int index = 1;
  assertNotNull(multiMap);
  assertEquals(true, multiMap.size() == DATA_COUNT);
  SortedSet<Integer> keys = new TreeSet<>(multiMap.keySet());
  for (Integer key : keys) {
    assertNotNull(key);
    assertEquals(index, key.intValue());
    HazelcastIntegrationTestUser user = multiMap.get(key).iterator().next();
    verifyHazelcastIntegrationTestUser(user, index);
    index++;
  }
}

相关文章