public Collection<HazelcastServerID> action() throws Exception { return map.get(subName); } }.run();
public Collection<String> getTableNames(int tenantId) { if (isClustered) { return this.sparkTableNames.get(tenantId); } else { return this.inMemSparkTableNames.get(tenantId); } }
public Collection<V> get(K key) { if(guavaMultiMap != null) { synchronized (guavaMultiMap) { Set<V> c = guavaMultiMap.get(key); if(c != null) return new HashSet<V>(c); else return null; } } return hcMultiMap.get(key); }
private void get(Object oid, Exchange exchange) { exchange.getOut().setBody(this.cache.get(oid)); }
private static void executeMultiMap() { System.out.println("### MultiMap Execution Started... ###"); int key = RANDOM.nextInt(100); int value = RANDOM.nextInt(100); MultiMap<Integer, Integer> multimap = (MultiMap<Integer, Integer>) context.getBean("multiMap", MultiMap.class); multimap.put(key, value); System.out.println("A random pair is added to multiMap."); System.out.println("Added value: " + multimap.get(key) + "\n"); }
/** * Get collection of currently used active locks on the object. * @param objId object id. * @return collection of active locks. */ @Override protected Collection<NlmLock> getActiveLocks(byte[] objId) { String key = objIdToKey(objId); return locks.get(key); }
@Override public Map<String, String> get(String outerKey) { Map<String, String> result = new HashMap<>(); Integer index = 0; for (String s : getMultiMap().get(outerKey)) { result.put(index.toString(), s); index++; } return result; }
@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(); } });
static void refreshGroups( HazelcastInstance hazelcastInstance, String memberId, List<String> groups ) { MultiMap<String,String> groupsMap = hazelcastInstance.getMultiMap( SERVER_GROUPS_MULTIMAP ); Collection<String> existing = groupsMap.get( memberId ); Set<String> superfluous = existing.stream().filter( t -> !groups.contains( t ) ).collect( Collectors.toSet() ); Set<String> missing = groups.stream().filter( t -> !existing.contains( t ) ).collect( Collectors.toSet() ); missing.forEach( group -> groupsMap.put( memberId, group ) ); superfluous.forEach( group -> groupsMap.remove( memberId, group ) ); }
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); } } }
public void run() { while (true) { int key = (int) (RANDOM.nextFloat() * entryCount); int operation = ((int) (RANDOM.nextFloat() * 100)); if (operation < getPercentage) { map.get(String.valueOf(key)); gets.incrementAndGet(); } else if (operation < getPercentage + putPercentage) { map.put(String.valueOf(key), new byte[valueSize]); puts.incrementAndGet(); } else { map.remove(String.valueOf(key)); removes.incrementAndGet(); } } } });
protected void handleMultiMapGet(String[] args) { println(getMultiMap().get(args[1])); }
protected void handleMultiMapGet(String[] args) { println(getMultiMap().get(args[1])); }
protected void handleMultiMapGet(String[] args) { println(getMultiMap().get(args[1])); }
protected void handleMultiMapGet(String[] args) { println(getMultiMap().get(args[1])); }
@Override public boolean delete(String outerKey) { if(outerKey != null) return false; if (outerKey.isEmpty()) { return true; } if (getMultiMap().get(outerKey) != null) { getMultiMap().clear(); } return true; } }
@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(); } });
public static void main(String[] args) { // Start the Embedded Hazelcast Cluster Member. HazelcastInstance hz = Hazelcast.newHazelcastInstance(); // Get the Distributed MultiMap from Cluster. MultiMap<String, String> multiMap = hz.getMultiMap("my-distributed-multimap"); // Put values in the map against the same key multiMap.put("my-key", "value1"); multiMap.put("my-key", "value2"); multiMap.put("my-key", "value3"); // Print out all the values for associated with key called "my-key" Collection<String> values = multiMap.get("my-key"); System.out.println(values); // remove specific key/value pair multiMap.remove("my-key", "value2"); // Shutdown the Hazelcast Cluster Member hz.shutdown(); } }
public static void main(String[] args) { // Start the Hazelcast Client and connect to an already running Hazelcast Cluster on 127.0.0.1 HazelcastInstance hz = HazelcastClient.newHazelcastClient(); // Get the Distributed MultiMap from Cluster. MultiMap<String, String> multiMap = hz.getMultiMap("my-distributed-multimap"); // Put values in the map against the same key multiMap.put("my-key", "value1"); multiMap.put("my-key", "value2"); multiMap.put("my-key", "value3"); // Print out all the values for associated with key called "my-key" Collection<String> values = multiMap.get("my-key"); System.out.println(values); // remove specific key/value pair multiMap.remove("my-key", "value2"); // Shutdown this Hazelcast Client hz.shutdown(); } }
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++; } }