private boolean initCurrentMap() { if (currentMap == null) { String mapName = snapshotContext.currentMapName(); if (mapName == null) { return false; } currentMap = nodeEngine.getHazelcastInstance().getMap(mapName); this.currentSnapshotId = snapshotContext.currentSnapshotId(); } return true; }
protected void handleHazelcastInstanceAwareParams(Object... objects) { for (Object object : objects) { if (object instanceof HazelcastInstanceAware) { ((HazelcastInstanceAware) object).setHazelcastInstance(getNodeEngine().getHazelcastInstance()); } } }
@Override public void innerBeforeRun() throws Exception { super.innerBeforeRun(); if (entryProcessor instanceof HazelcastInstanceAware) { HazelcastInstance hazelcastInstance = getNodeEngine().getHazelcastInstance(); ((HazelcastInstanceAware) entryProcessor).setHazelcastInstance(hazelcastInstance); } }
private <T extends EventListener> T initializeListener(ListenerConfig listenerConfig) { T listener = getListenerImplOrNull(listenerConfig); if (listener instanceof HazelcastInstanceAware) { ((HazelcastInstanceAware) listener).setHazelcastInstance(getNodeEngine().getHazelcastInstance()); } return listener; }
@Override public void shutdown() { ExecutionService executionService = nodeEngine.getExecutionService(); executionService.shutdownExecutor(invalidationExecutorName); HazelcastInstance node = nodeEngine.getHazelcastInstance(); LifecycleService lifecycleService = node.getLifecycleService(); lifecycleService.removeLifecycleListener(nodeShutdownListenerId); invalidationQueues.clear(); super.shutdown(); }
@Override public <SuppliedValue, Result> Result aggregate(Supplier<K, V, SuppliedValue> supplier, Aggregation<K, SuppliedValue, Result> aggregation) { HazelcastInstance hazelcastInstance = getNodeEngine().getHazelcastInstance(); JobTracker jobTracker = hazelcastInstance.getJobTracker("hz::aggregation-multimap-" + getName()); return aggregate(supplier, aggregation, jobTracker); }
private void addMessageListener(ListenerConfig listenerConfig) { NodeEngine nodeEngine = getNodeEngine(); MessageListener listener = loadListener(listenerConfig); if (listener == null) { return; } if (listener instanceof HazelcastInstanceAware) { HazelcastInstanceAware hazelcastInstanceAware = (HazelcastInstanceAware) listener; hazelcastInstanceAware.setHazelcastInstance(nodeEngine.getHazelcastInstance()); } addMessageListener(listener); }
@Override public void shutdown() { ExecutionService executionService = nodeEngine.getExecutionService(); executionService.shutdownExecutor(invalidationExecutorName); HazelcastInstance node = nodeEngine.getHazelcastInstance(); LifecycleService lifecycleService = node.getLifecycleService(); lifecycleService.removeLifecycleListener(nodeShutdownListenerId); invalidationQueues.clear(); super.shutdown(); }
private void initialize(ListenerConfig listenerConfig) { NodeEngine nodeEngine = getNodeEngine(); MessageListener listener = loadListener(listenerConfig); if (listener == null) { return; } if (listener instanceof HazelcastInstanceAware) { HazelcastInstanceAware hazelcastInstanceAware = (HazelcastInstanceAware) listener; hazelcastInstanceAware.setHazelcastInstance(nodeEngine.getHazelcastInstance()); } addMessageListenerInternal(listener); }
private void addMessageListener(ListenerConfig listenerConfig) { NodeEngine nodeEngine = getNodeEngine(); MessageListener listener = loadListener(listenerConfig); if (listener == null) { return; } if (listener instanceof HazelcastInstanceAware) { HazelcastInstanceAware hazelcastInstanceAware = (HazelcastInstanceAware) listener; hazelcastInstanceAware.setHazelcastInstance(nodeEngine.getHazelcastInstance()); } addMessageListener(listener); }
private <V> IScheduledFuture<V> createFutureProxy(int partitionId, String taskName) { ScheduledFutureProxy proxy = new ScheduledFutureProxy(ScheduledTaskHandlerImpl.of(partitionId, getName(), taskName), this); proxy.setHazelcastInstance(getNodeEngine().getHazelcastInstance()); return proxy; }
private <V> IScheduledFuture<V> createFutureProxy(Address address, String taskName) { ScheduledFutureProxy proxy = new ScheduledFutureProxy(ScheduledTaskHandlerImpl.of(address, getName(), taskName), this); proxy.setHazelcastInstance(getNodeEngine().getHazelcastInstance()); return proxy; }
private <V> IScheduledFuture<V> createFutureProxy(int partitionId, String taskName) { ScheduledFutureProxy proxy = new ScheduledFutureProxy(ScheduledTaskHandlerImpl.of(partitionId, getName(), taskName), this); proxy.setHazelcastInstance(getNodeEngine().getHazelcastInstance()); return proxy; }
private <V> IScheduledFuture<V> createFutureProxy(Address address, String taskName) { ScheduledFutureProxy proxy = new ScheduledFutureProxy(ScheduledTaskHandlerImpl.of(address, getName(), taskName), this); proxy.setHazelcastInstance(getNodeEngine().getHazelcastInstance()); return proxy; }
@Override public <SuppliedValue, Result> Result aggregate(Supplier<K, V, SuppliedValue> supplier, Aggregation<K, SuppliedValue, Result> aggregation) { checkTrue(NATIVE != mapConfig.getInMemoryFormat(), "NATIVE storage format is not supported for MapReduce"); HazelcastInstance hazelcastInstance = getNodeEngine().getHazelcastInstance(); JobTracker jobTracker = hazelcastInstance.getJobTracker("hz::aggregation-map-" + getName()); return aggregate(supplier, aggregation, jobTracker); }
private static void callLifecycleSupportInit(MapStoreContext mapStoreContext) { final MapStoreWrapper mapStoreWrapper = mapStoreContext.getMapStoreWrapper(); final MapServiceContext mapServiceContext = mapStoreContext.getMapServiceContext(); final NodeEngine nodeEngine = mapServiceContext.getNodeEngine(); final HazelcastInstance hazelcastInstance = nodeEngine.getHazelcastInstance(); final MapStoreConfig mapStoreConfig = mapStoreContext.getMapStoreConfig(); final Properties properties = mapStoreConfig.getProperties(); final String mapName = mapStoreContext.getMapName(); mapStoreWrapper.init(hazelcastInstance, properties, mapName); }
@Override public V get(K key) { Data keyData = nodeEngine.toData(key); GetOperation operation = new GetOperation(name, keyData); int partitionId = nodeEngine.getPartitionService().getPartitionId(key); OperationService operationService = HazelcastTestUtils.getOperationService(nodeEngine.getHazelcastInstance()); return operationService .<V>invokeOnPartition(SyntheticMapService.SERVICE_NAME, operation, partitionId) .join(); }
@Override public V get(K key) { Data keyData = nodeEngine.toData(key); GetOperation operation = new GetOperation(name, keyData); int partitionId = nodeEngine.getPartitionService().getPartitionId(key); OperationService operationService = HazelcastTestUtils.getOperationService(nodeEngine.getHazelcastInstance()); return operationService .<V>invokeOnPartition(SyntheticMapService.SERVICE_NAME, operation, partitionId) .join(); }
private static void callLifecycleSupportInit(MapStoreContext mapStoreContext) { final MapStoreWrapper mapStoreWrapper = mapStoreContext.getMapStoreWrapper(); final MapServiceContext mapServiceContext = mapStoreContext.getMapServiceContext(); final NodeEngine nodeEngine = mapServiceContext.getNodeEngine(); final HazelcastInstance hazelcastInstance = nodeEngine.getHazelcastInstance(); final MapStoreConfig mapStoreConfig = mapStoreContext.getMapStoreConfig(); final Properties properties = mapStoreConfig.getProperties(); final String mapName = mapStoreContext.getMapName(); mapStoreWrapper.init(hazelcastInstance, properties, mapName); }
@Override public void put(K key, V value) { Data keyData = nodeEngine.toData(key); Data valueData = nodeEngine.toData(value); PutOperation operation = new PutOperation(name, keyData, valueData); int partitionId = nodeEngine.getPartitionService().getPartitionId(key); OperationService operationService = HazelcastTestUtils.getOperationService(nodeEngine.getHazelcastInstance()); operationService .<V>invokeOnPartition(SyntheticMapService.SERVICE_NAME, operation, partitionId) .getSafely(); }