Search in sources :

Example 91 with NodeEngine

use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.

the class MapProxySupport method addMapInterceptorInternal.

public String addMapInterceptorInternal(MapInterceptor interceptor) {
    NodeEngine nodeEngine = getNodeEngine();
    if (interceptor instanceof HazelcastInstanceAware) {
        ((HazelcastInstanceAware) interceptor).setHazelcastInstance(nodeEngine.getHazelcastInstance());
    }
    String id = mapServiceContext.generateInterceptorId(name, interceptor);
    Collection<Member> members = nodeEngine.getClusterService().getMembers();
    for (Member member : members) {
        try {
            AddInterceptorOperation op = new AddInterceptorOperation(id, interceptor, name);
            Future future = operationService.invokeOnTarget(SERVICE_NAME, op, member.getAddress());
            future.get();
        } catch (Throwable t) {
            throw rethrow(t);
        }
    }
    return id;
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) AddInterceptorOperation(com.hazelcast.map.impl.operation.AddInterceptorOperation) Future(java.util.concurrent.Future) InternalCompletableFuture(com.hazelcast.spi.InternalCompletableFuture) HazelcastInstanceAware(com.hazelcast.core.HazelcastInstanceAware) Member(com.hazelcast.core.Member)

Example 92 with NodeEngine

use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.

the class NodeQueryCacheEventService method canPassFilter.

private boolean canPassFilter(LocalEntryEventData localEntryEventData, EventFilter filter) {
    if (filter == null || filter instanceof TrueEventFilter) {
        return true;
    }
    NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    SerializationService serializationService = nodeEngine.getSerializationService();
    Data keyData = localEntryEventData.getKeyData();
    Object value = getValueOrOldValue(localEntryEventData);
    QueryableEntry entry = new QueryEntry((InternalSerializationService) serializationService, keyData, value, Extractors.empty());
    return filter.eval(entry);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) QueryEntry(com.hazelcast.query.impl.QueryEntry) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService) SerializationService(com.hazelcast.spi.serialization.SerializationService) LocalCacheWideEventData(com.hazelcast.map.impl.querycache.event.LocalCacheWideEventData) EventData(com.hazelcast.map.impl.event.EventData) Data(com.hazelcast.nio.serialization.Data) LocalEntryEventData(com.hazelcast.map.impl.querycache.event.LocalEntryEventData) TrueEventFilter(com.hazelcast.spi.impl.eventservice.impl.TrueEventFilter) QueryableEntry(com.hazelcast.query.impl.QueryableEntry)

Example 93 with NodeEngine

use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.

the class NodeQueryCacheEventService method getRegistrations.

private Collection<EventRegistration> getRegistrations(String mapName) {
    MapServiceContext mapServiceContext = this.mapServiceContext;
    NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    EventService eventService = nodeEngine.getEventService();
    return eventService.getRegistrations(MapService.SERVICE_NAME, mapName);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) QueryCacheEventService(com.hazelcast.map.impl.querycache.QueryCacheEventService) EventService(com.hazelcast.spi.EventService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 94 with NodeEngine

use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.

the class NodeQueryCacheEventService method removeListener.

@Override
public boolean removeListener(String mapName, String cacheName, String id) {
    String listenerName = generateListenerName(mapName, cacheName);
    NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    EventService eventService = nodeEngine.getEventService();
    return eventService.deregisterListener(MapService.SERVICE_NAME, listenerName, id);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) QueryCacheEventService(com.hazelcast.map.impl.querycache.QueryCacheEventService) EventService(com.hazelcast.spi.EventService)

Example 95 with NodeEngine

use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.

the class ExecutorServiceProxy method submitToAllMembers.

@Override
public <T> void submitToAllMembers(Callable<T> task, MultiExecutionCallback callback) {
    NodeEngine nodeEngine = getNodeEngine();
    submitToMembers(task, nodeEngine.getClusterService().getMembers(), callback);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine)

Aggregations

NodeEngine (com.hazelcast.spi.NodeEngine)163 Data (com.hazelcast.nio.serialization.Data)50 OperationService (com.hazelcast.spi.OperationService)30 Address (com.hazelcast.nio.Address)25 ILogger (com.hazelcast.logging.ILogger)20 Operation (com.hazelcast.spi.Operation)14 IPartitionService (com.hazelcast.spi.partition.IPartitionService)14 Member (com.hazelcast.core.Member)12 Future (java.util.concurrent.Future)12 InternalCompletableFuture (com.hazelcast.spi.InternalCompletableFuture)11 Test (org.junit.Test)10 InitializingObject (com.hazelcast.spi.InitializingObject)9 ParallelTest (com.hazelcast.test.annotation.ParallelTest)9 QuickTest (com.hazelcast.test.annotation.QuickTest)9 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)8 AbstractDistributedObject (com.hazelcast.spi.AbstractDistributedObject)8 ArrayList (java.util.ArrayList)8 Map (java.util.Map)8 HazelcastInstance (com.hazelcast.core.HazelcastInstance)7 InternalPartitionServiceImpl (com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl)7