/** * Returns {@code true} if the given collection is not {@code null} and not empty, otherwise returns {@code false}. * * @param collection the given collection * @return {@code true} if collection is not empty */ public static boolean isNotEmpty(Collection collection) { return !isEmpty(collection); }
/** * Returns {@code true} if the given collection is not {@code null} and not empty, otherwise returns {@code false}. * * @param collection the given collection * @return {@code true} if collection is not empty */ public static boolean isNotEmpty(Collection collection) { return !isEmpty(collection); }
/** * @return {@code true} if this class contains any registered * listener for the cache represented with the supplied {@code cacheId} else returns {@code false} */ public boolean hasListener(String cacheId) { Collection<ListenerInfo> listenerInfos = registrations.get(cacheId); return !isEmpty(listenerInfos); }
/** * @return {@code true} if this class contains any registered * listener for the cache represented with the supplied {@code cacheId} else returns {@code false} */ public boolean hasListener(String cacheId) { Collection<ListenerInfo> listenerInfos = registrations.get(cacheId); return !isEmpty(listenerInfos); }
@SuppressWarnings("unchecked") Collection<ListenerInfo> getListenerInfos(String cacheId) { Collection<ListenerInfo> infos = registrations.get(cacheId); return isEmpty(infos) ? Collections.<ListenerInfo>emptySet() : infos; } }
@SuppressWarnings("unchecked") Collection<ListenerInfo> getListenerInfos(String cacheId) { Collection<ListenerInfo> infos = registrations.get(cacheId); return isEmpty(infos) ? Collections.<ListenerInfo>emptySet() : infos; } }
public PutFromLoadAllOperation(String name, List<Data> keyValueSequence) { super(name); checkFalse(isEmpty(keyValueSequence), "key-value sequence cannot be empty or null"); this.keyValueSequence = keyValueSequence; }
public PutFromLoadAllOperation(String name, List<Data> keyValueSequence) { super(name); checkFalse(isEmpty(keyValueSequence), "key-value sequence cannot be empty or null"); this.keyValueSequence = keyValueSequence; }
@Override public void addFirst(Collection<DelayedEntry> collection) { if (isEmpty(collection)) { return; } int expectedCapacity = map.size() + collection.size(); Map<Data, DelayedEntry> newMap = createLinkedHashMap(expectedCapacity); for (DelayedEntry next : collection) { newMap.put((Data) next.getKey(), next); } newMap.putAll(map); map = newMap; }
@Override public void addFirst(Collection<DelayedEntry> collection) { if (isEmpty(collection)) { return; } int expectedCapacity = map.size() + collection.size(); Map<Data, DelayedEntry> newMap = createLinkedHashMap(expectedCapacity); for (DelayedEntry next : collection) { newMap.put((Data) next.getKey(), next); } newMap.putAll(map); map = newMap; }
protected Map<K, Object> prepareResult(Collection<Entry<Data, Data>> entries) { if (CollectionUtil.isEmpty(entries)) { return emptyMap(); } Map<K, Object> result = createHashMap(entries.size()); for (Entry<Data, Data> entry : entries) { K key = toObject(entry.getKey()); result.put(key, toObject(entry.getValue())); } return result; }
protected Map<K, Object> prepareResult(Collection<Entry<Data, Data>> entries) { if (CollectionUtil.isEmpty(entries)) { return emptyMap(); } Map<K, Object> result = createHashMap(entries.size()); for (Entry<Data, Data> entry : entries) { K key = toObject(entry.getKey()); result.put(key, toObject(entry.getValue())); } return result; }
@Override public void publishEvent(Address caller, String mapName, EntryEventType eventType, Data dataKey, Object oldValue, Object value, Object mergingValue) { Collection<EventRegistration> registrations = getRegistrations(mapName); if (isEmpty(registrations)) { return; } publishEvent(registrations, caller, mapName, eventType, dataKey, oldValue, value, mergingValue); }
@Override public void handleDisconnectedSubscriber(String uuid) { Collection<PartitionAccumulatorRegistry> removalCandidates = getRemovalCandidates(uuid); if (isEmpty(removalCandidates)) { return; } startRemovalTask(removalCandidates, uuid); }
@Override public void handleDisconnectedSubscriber(String uuid) { Collection<PartitionAccumulatorRegistry> removalCandidates = getRemovalCandidates(uuid); if (isEmpty(removalCandidates)) { return; } startRemovalTask(removalCandidates, uuid); }
@Override public void publishEvent(Address caller, String mapName, EntryEventType eventType, Data dataKey, Object oldValue, Object value, Object mergingValue) { Collection<EventRegistration> registrations = getRegistrations(mapName); if (isEmpty(registrations)) { return; } publishEvent(registrations, caller, mapName, eventType, dataKey, oldValue, value, mergingValue); }
public void trySendExpiryOp(RS recordStore, InvalidationQueue expiredKeyQueue, int backupReplicaCount, int partitionId, boolean sendIfAtBatchSize) { if (sendIfAtBatchSize && expiredKeyQueue.size() < TARGET_BATCH_SIZE) { return; } Collection<ExpiredKey> expiredKeys = pollExpiredKeys(expiredKeyQueue); if (CollectionUtil.isEmpty(expiredKeys)) { return; } // send expired keys to all backups invokeBackupExpiryOperation(expiredKeys, backupReplicaCount, partitionId, recordStore); }
public void trySendExpiryOp(RS recordStore, InvalidationQueue expiredKeyQueue, int backupReplicaCount, int partitionId, boolean sendIfAtBatchSize) { if (sendIfAtBatchSize && expiredKeyQueue.size() < TARGET_BATCH_SIZE) { return; } Collection<ExpiredKey> expiredKeys = pollExpiredKeys(expiredKeyQueue); if (CollectionUtil.isEmpty(expiredKeys)) { return; } // send expired keys to all backups invokeBackupExpiryOperation(expiredKeys, backupReplicaCount, partitionId, recordStore); }
protected final void invalidateNearCache(List<Data> keys) { if (!mapContainer.hasInvalidationListener() || isEmpty(keys)) { return; } Invalidator invalidator = getNearCacheInvalidator(); for (Data key : keys) { invalidator.invalidateKey(key, name, getCallerUuid()); } }
protected final void invalidateNearCache(List<Data> keys) { if (!mapContainer.hasInvalidationListener() || isEmpty(keys)) { return; } Invalidator invalidator = getNearCacheInvalidator(); for (Data key : keys) { invalidator.invalidateKey(key, name, getCallerUuid()); } }