/** * Creates a new ReliableTopicConfig with default settings. */ public ReliableTopicConfig(String name) { this.name = checkNotNull(name, "name"); }
/** * Sets the {@link MergePolicyConfig} for this replicated map. * * @return the updated replicated map configuration */ public ReplicatedMapConfig setMergePolicyConfig(MergePolicyConfig mergePolicyConfig) { this.mergePolicyConfig = checkNotNull(mergePolicyConfig, "mergePolicyConfig cannot be null!"); return this; }
public void addCardinalityEstimator(String name, CardinalityEstimatorContainer container) { checkNotNull(name, "Name can't be null"); checkNotNull(container, "Container can't be null"); containers.put(name, container); }
@Override public ICompletableFuture<Void> setAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdle, TimeUnit maxIdleUnit) { checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED); checkNotNull(value, NULL_VALUE_IS_NOT_ALLOWED); return setAsyncInternal(ttl, ttlUnit, maxIdle, maxIdleUnit, key, value); }
@Override public V put(K key, V value, long ttl, TimeUnit timeunit) { checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED); checkNotNull(value, NULL_VALUE_IS_NOT_ALLOWED); return putInternal(ttl, timeunit, null, null, key, value); }
@Override public V putIfAbsent(K key, V value, long ttl, TimeUnit timeunit) { checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED); checkNotNull(value, NULL_VALUE_IS_NOT_ALLOWED); return putIfAbsentInternal(ttl, timeunit, null, null, key, value); }
@Override public String addEntryListener(MapListener listener, Predicate<K, V> predicate, K key, boolean includeValue) { checkNotNull(listener, NULL_LISTENER_IS_NOT_ALLOWED); checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED); checkNotNull(key, NULL_PREDICATE_IS_NOT_ALLOWED); ListenerAdapter<IMapEvent> listenerAdaptor = createListenerAdapter(listener); return addEntryListenerInternal(listenerAdaptor, predicate, key, includeValue); }
@Override public ICondition newCondition(String name) { checkNotNull(name, "Condition name can't be null"); return new ConditionImpl(this, name); }
@Override public void loadAll(Set<K> keys, boolean replaceExistingValues) { checkNotNull(keys, "Parameter keys should not be null."); if (keys.isEmpty()) { return; } loadAllInternal(replaceExistingValues, keys); }
@Override public QueryCache<K, V> getQueryCache(String name, MapListener listener, Predicate<K, V> predicate, boolean includeValue) { checkNotNull(name, "name cannot be null"); checkNotNull(predicate, "predicate cannot be null"); checkNotInstanceOf(PagingPredicate.class, predicate, "predicate"); return getQueryCacheInternal(name, listener, predicate, includeValue, this); }
private List<Data> toDataList(Collection<?> objects) { final NodeEngine nodeEngine = getNodeEngine(); List<Data> dataList = new ArrayList<Data>(objects.size()); for (Object o : objects) { checkNotNull(o, "Object is null"); dataList.add(nodeEngine.toData(o)); } return dataList; }
@Override public boolean tryLock(long time, TimeUnit unit) throws InterruptedException { checkNotNull(unit, "unit can't be null"); return lockSupport.tryLock(getNodeEngine(), key, time, unit); }
@Override public Addresses loadAddresses() { Iterable<DiscoveryNode> discoveredNodes = checkNotNull(discoveryService.discoverNodes(), "Discovered nodes cannot be null!"); Addresses possibleMembers = new Addresses(); for (DiscoveryNode discoveryNode : discoveredNodes) { possibleMembers.primary().add(discoveryNode.getPrivateAddress()); } return possibleMembers; } }
@Override public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException { checkNotNull(e, "item can't be null"); Data data = toData(e); ClientMessage request = QueueOfferCodec.encodeRequest(name, data, unit.toMillis(timeout)); ClientMessage response = invokeOnPartitionInterruptibly(request); QueueOfferCodec.ResponseParameters resultParameters = QueueOfferCodec.decodeResponse(response); return resultParameters.response; }
@Override public void add(int index, E element) { checkNotNull(element); Data value = toData(element); ClientMessage request = ListAddWithIndexCodec.encodeRequest(name, index, value); invokeOnPartition(request); }
@Override public void enableStatistics(String cacheName, boolean enabled) { ensureOpen(); checkNotNull(cacheName, "cacheName cannot be null"); String cacheNameWithPrefix = getCacheNameWithPrefix(cacheName); cacheService.setStatisticsEnabled(null, cacheNameWithPrefix, enabled); enableStatisticManagementOnOtherNodes(cacheName, true, enabled); }
@Override public void lock(K key) { checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED); final Data keyData = toData(key); ClientMessage request = MultiMapLockCodec .encodeRequest(name, keyData, ThreadUtil.getThreadId(), -1, lockReferenceIdGenerator.getNextReferenceId()); invoke(request, keyData); }
@Override public void unlock(K key) { checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED); final Data keyData = toData(key); ClientMessage request = MultiMapUnlockCodec .encodeRequest(name, keyData, ThreadUtil.getThreadId(), lockReferenceIdGenerator.getNextReferenceId()); invoke(request, keyData); }
@Override public boolean addAll(int index, Collection<? extends E> c) { checkNotNull(c); Collection<Data> dataCollection = objectToDataCollection(c, getSerializationService()); ClientMessage request = ListAddAllWithIndexCodec.encodeRequest(name, index, dataCollection); ClientMessage response = invokeOnPartition(request); ListAddAllWithIndexCodec.ResponseParameters resultParameters = ListAddAllWithIndexCodec.decodeResponse(response); return resultParameters.response; }
@Override public boolean retainAll(Collection<?> c) { checkNotNull(c); Collection<Data> dataCollection = objectToDataCollection(c, getSerializationService()); ClientMessage request = ListCompareAndRetainAllCodec.encodeRequest(name, dataCollection); ClientMessage response = invokeOnPartition(request); ListCompareAndRetainAllCodec.ResponseParameters resultParameters = ListCompareAndRetainAllCodec.decodeResponse(response); return resultParameters.response; }