private void delete(Object oid) { this.cache.remove(oid); }
public Collection<V> remove(Object key) { return hcMultiMap.remove(key); }
private void removevalue(Object oid, Exchange exchange) { this.cache.remove(oid, exchange.getIn().getBody()); }
public boolean remove(Object key, Object value) { if(guavaMultiMap != null) return guavaMultiMap.remove(key, value); return hcMultiMap.remove(key, value); }
@Override protected boolean remove(byte[] objId, NlmLock lock) { String key = objIdToKey(objId); return locks.remove(key, lock); }
@Override protected void removeAll(byte[] objId, Collection<NlmLock> locks) { String key = objIdToKey(objId); locks.forEach(l -> this.locks.remove(key, l)); }
public Boolean action() throws Exception { return map.remove(subName, new HazelcastServerID(serverID)); } }.run();
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 int removeAll(Object key, Collection<Object> values) { int totalRemoved = 0; if(guavaMultiMap != null) { synchronized (guavaMultiMap) { for(Object o : values) { if(guavaMultiMap.remove(key, o)) totalRemoved ++; } } } else { for(Object o : values) { if(hcMultiMap.remove(key, o)) totalRemoved ++; } } return totalRemoved; }
public Void action() throws Exception { for (Map.Entry<String, HazelcastServerID> entry: map.entrySet()) { HazelcastServerID hid = entry.getValue(); if (hid.serverID.equals(serverID)) { map.remove(entry.getKey(), hid); } } return null; } }.run();
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 handleMultiMapRemove(String[] args) { println(getMultiMap().remove(args[1])); }
protected void handleMultiMapRemove(String[] args) { println(getMultiMap().remove(args[1])); }
protected void handleMultiMapRemove(String[] args) { println(getMultiMap().remove(args[1])); }
protected void handleMultiMapRemove(String[] args) { println(getMultiMap().remove(args[1])); }
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(); } }
@Override public boolean removeJob(final JobKey jobKey) throws JobPersistenceException { boolean removed = false; if (jobsByKey.containsKey(jobKey)) { final List<OperableTrigger> triggersForJob = getTriggersForJob(jobKey); for (final OperableTrigger trigger : triggersForJob) { if (!removeTrigger(trigger.getKey(), false)) { LOG.warn("Error deleting trigger [{}] of job [{}] .", trigger, jobKey); return false; } } jobsByKey.lock(jobKey, 5, TimeUnit.MILLISECONDS); try { jobsByGroup.remove(jobKey.getGroup(), jobKey); removed = jobsByKey.remove(jobKey) != null; } finally { try { jobsByKey.unlock(jobKey); } catch (IllegalMonitorStateException ex) { LOG.warn("Error unlocking since it is already released.", ex); } } } return removed; }
if (removed) { triggersByGroup.remove(key.getGroup(), key);
public static void testEventDrivenForMultiMapEntryEvents( final MultiMap<Integer, HazelcastIntegrationTestUser> multiMap, final PollableChannel channel, final String cacheName) { multiMap.put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1")); Message<?> msg = channel.receive(TIMEOUT); verifyEntryEvent(msg, cacheName, EntryEventType.ADDED); multiMap.put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurnameUpdated")); msg = channel.receive(TIMEOUT); verifyEntryEvent(msg, cacheName, EntryEventType.ADDED); multiMap.remove(1); msg = channel.receive(TIMEOUT); verifyEntryEvent(msg, cacheName, EntryEventType.REMOVED); msg = channel.receive(TIMEOUT); verifyEntryEvent(msg, cacheName, EntryEventType.REMOVED); multiMap.put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2")); msg = channel.receive(TIMEOUT); verifyEntryEvent(msg, cacheName, EntryEventType.ADDED); multiMap.clear(); msg = channel.receive(TIMEOUT); verifyEntryEvent(msg, cacheName, EntryEventType.CLEAR_ALL); }