@Override public String getName() { return map.getName(); }
@Override public String getName() { return cache.getName(); }
@Override public void run(String... arg0) throws Exception { IMap<String, String> helloMap = this.hazelcastInstance.getMap("hello"); if (!helloMap.isEmpty()) { LOGGER.info("Skip loading '{}', not empty", helloMap.getName()); } else { Arrays.stream(GREETINGS).forEach(pair -> { helloMap.set(pair[0], pair[1]); }); LOGGER.info("Loaded {} into '{}'", GREETINGS.length, helloMap.getName()); } }
@Override public Collection<String> getCacheNames() { Set<String> cacheNames = new HashSet<String>(); Collection<DistributedObject> distributedObjects = hazelcastInstance.getDistributedObjects(); for (DistributedObject distributedObject : distributedObjects) { if (distributedObject instanceof IMap) { IMap<?, ?> map = (IMap) distributedObject; cacheNames.add(map.getName()); } } return cacheNames; }
/** * A helper method to build a KeyValueSource implementation based on the specified {@link IMap} * * @param map map to build a KeyValueSource implementation * @param <K> key type of the map * @param <V> value type of the map * @return KeyValueSource implementation based on the specified map */ public static <K, V> KeyValueSource<K, V> fromMap(IMap<? super K, ? extends V> map) { return new MapKeyValueSource<K, V>(map.getName()); }
/** * Convenience for {@link #mapWithMerging(IMap, DistributedFunction, DistributedFunction, * DistributedBinaryOperator)} with {@link Entry} as input item. */ @Nonnull public static <K, V, V_IN extends V> Sink<Entry<K, V_IN>> mapWithMerging( @Nonnull IMap<? super K, V> map, @Nonnull DistributedBinaryOperator<V> mergeFn ) { return mapWithMerging(map.getName(), mergeFn); }
/** * Convenience for {@link #mapWithUpdating(IMap, DistributedFunction, * DistributedBiFunction)} with {@link Entry} as the input item. */ @Nonnull public static <K, V, E extends Entry<K, V>> Sink<E> mapWithUpdating( @Nonnull IMap<? super K, ? super V> map, @Nonnull DistributedBiFunction<? super V, ? super E, ? extends V> updateFn ) { return mapWithUpdating(map.getName(), updateFn); }
/** * A helper method to build a KeyValueSource implementation based on the specified {@link IMap} * * @param map map to build a KeyValueSource implementation * @param <K> key type of the map * @param <V> value type of the map * @return KeyValueSource implementation based on the specified map */ public static <K, V> KeyValueSource<K, V> fromMap(IMap<? super K, ? extends V> map) { return new MapKeyValueSource<K, V>(map.getName()); }
public QueryCacheRequest forMap(IMap map) { this.map = checkNotNull(map, "map cannot be null"); this.mapName = map.getName(); return this; }
@ManagedAnnotation("name") @ManagedDescription("name of the map") public String getName() { return managedObject.getName(); }
@Override public Object execute(TransactionalTaskContext transactionalTaskContext) { TransactionalMap<Integer, Integer> txMap = transactionalTaskContext.getMap(map.getName()); txMap.get(key); return null; } });
@ManagedAnnotation("name") @ManagedDescription("name of the map") public String getName() { return managedObject.getName(); }
protected MapMBean(IMap managedObject, ManagementService service) { super(managedObject, service); this.objectName = service.createObjectName("IMap", managedObject.getName()); StatsSupplier<LocalMapStats> localMapStatsSupplier = new LocalMapStatsSupplier(managedObject); this.localMapStatsDelegate = new LocalStatsDelegate<LocalMapStats>(localMapStatsSupplier, updateIntervalSec); }
protected MapMBean(IMap managedObject, ManagementService service) { super(managedObject, service); this.objectName = service.createObjectName("IMap", managedObject.getName()); StatsSupplier<LocalMapStats> localMapStatsSupplier = new LocalMapStatsSupplier(managedObject); this.localMapStatsDelegate = new LocalStatsDelegate<LocalMapStats>(localMapStatsSupplier, updateIntervalSec); }
@Override public String addEntryListener(MapListener listener, Predicate<K, V> predicate, boolean includeValue) { checkNotNull(listener, "listener cannot be null"); checkNotNull(predicate, "predicate cannot be null"); QueryCacheEventService eventService = getEventService(); EventFilter filter = new QueryEventFilter(includeValue, null, predicate); String mapName = delegate.getName(); return eventService.addListener(mapName, cacheId, listener, filter); }
private String addEntryListenerInternal(MapListener listener, K key, boolean includeValue) { checkNotNull(listener, "listener cannot be null"); Data keyData = toData(key); EventFilter filter = new EntryEventFilter(includeValue, keyData); QueryCacheEventService eventService = getEventService(); String mapName = delegate.getName(); return eventService.addListener(mapName, cacheId, listener, filter); }
@ManagedAnnotation("config") @ManagedDescription("MapConfig") public String getConfig() { return service.instance.getConfig().findMapConfig(managedObject.getName()).toString(); }
@Override public String addEntryListener(MapListener listener, Predicate<K, V> predicate, boolean includeValue) { checkNotNull(listener, "listener cannot be null"); checkNotNull(predicate, "predicate cannot be null"); QueryCacheEventService eventService = getEventService(); EventFilter filter = new QueryEventFilter(includeValue, null, predicate); String mapName = delegate.getName(); return eventService.addListener(mapName, cacheId, listener, filter); }
public AbstractMapQueryPartitionIterator(IMap<K, V> map, int fetchSize, int partitionId, Predicate<K, V> predicate, Projection<Entry<K, V>, R> projection) { this.map = map; this.fetchSize = fetchSize; this.partitionId = partitionId; this.query = Query.of() .mapName(map.getName()) .iterationType(IterationType.VALUE) .predicate(predicate) .projection(projection) .build(); }
@Override public String addEntryListener(MapListener listener, Predicate<K, V> predicate, K key, boolean includeValue) { checkNotNull(listener, "listener cannot be null"); checkNotNull(predicate, "predicate cannot be null"); checkNotNull(key, "key cannot be null"); QueryCacheEventService eventService = getEventService(); EventFilter filter = new QueryEventFilter(includeValue, toData(key), predicate); String mapName = delegate.getName(); return eventService.addListener(mapName, cacheId, listener, filter); }