Search in sources :

Example 56 with NodeEngine

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

the class MapProxySupport method removeMapInterceptorInternal.

public void removeMapInterceptorInternal(String id) {
    NodeEngine nodeEngine = getNodeEngine();
    mapServiceContext.removeInterceptor(name, id);
    Collection<Member> members = nodeEngine.getClusterService().getMembers();
    for (Member member : members) {
        try {
            if (member.localMember()) {
                continue;
            }
            RemoveInterceptorOperation op = new RemoveInterceptorOperation(name, id);
            Future future = operationService.invokeOnTarget(SERVICE_NAME, op, member.getAddress());
            future.get();
        } catch (Throwable t) {
            throw rethrow(t);
        }
    }
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) Future(java.util.concurrent.Future) InternalCompletableFuture(com.hazelcast.spi.InternalCompletableFuture) RemoveInterceptorOperation(com.hazelcast.map.impl.operation.RemoveInterceptorOperation) Member(com.hazelcast.core.Member)

Example 57 with NodeEngine

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

the class AbstractPromotionOperation method sendMigrationEvent.

void sendMigrationEvent(final MigrationStatus status) {
    final int partitionId = getPartitionId();
    final NodeEngine nodeEngine = getNodeEngine();
    final Member localMember = nodeEngine.getLocalMember();
    final MigrationEvent event = new MigrationEvent(partitionId, null, localMember, status);
    final EventService eventService = nodeEngine.getEventService();
    final Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, MIGRATION_EVENT_TOPIC);
    eventService.publishEvent(SERVICE_NAME, registrations, event, partitionId);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) EventRegistration(com.hazelcast.spi.EventRegistration) EventService(com.hazelcast.spi.EventService) Member(com.hazelcast.core.Member) MigrationEvent(com.hazelcast.core.MigrationEvent) PartitionMigrationEvent(com.hazelcast.spi.PartitionMigrationEvent)

Example 58 with NodeEngine

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

the class ReplicaSyncRequest method createResponse.

private ReplicaSyncResponse createResponse(List<Operation> data) throws IOException {
    int partitionId = getPartitionId();
    NodeEngine nodeEngine = getNodeEngine();
    InternalPartitionService partitionService = (InternalPartitionService) nodeEngine.getPartitionService();
    long[] replicaVersions = partitionService.getPartitionReplicaVersions(partitionId);
    ReplicaSyncResponse syncResponse = new ReplicaSyncResponse(data, replicaVersions);
    syncResponse.setPartitionId(partitionId).setReplicaIndex(getReplicaIndex());
    return syncResponse;
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService)

Example 59 with NodeEngine

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

the class ReplicaSyncRequest method sendResponse.

/** Send a synchronization response to the caller replica containing the replication operations to be executed */
private void sendResponse(List<Operation> data) throws IOException {
    NodeEngine nodeEngine = getNodeEngine();
    ReplicaSyncResponse syncResponse = createResponse(data);
    Address target = getCallerAddress();
    ILogger logger = getLogger();
    if (logger.isFinestEnabled()) {
        logger.finest("Sending sync response to -> " + target + " for partitionId=" + getPartitionId() + ", replicaIndex=" + getReplicaIndex());
    }
    OperationService operationService = nodeEngine.getOperationService();
    operationService.send(syncResponse, target);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) Address(com.hazelcast.nio.Address) ILogger(com.hazelcast.logging.ILogger) OperationService(com.hazelcast.spi.OperationService)

Example 60 with NodeEngine

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

the class ReplicaSyncResponse method prepareOperation.

private void prepareOperation(Operation op) {
    int partitionId = getPartitionId();
    int replicaIndex = getReplicaIndex();
    NodeEngine nodeEngine = getNodeEngine();
    ILogger opLogger = nodeEngine.getLogger(op.getClass());
    OperationResponseHandler responseHandler = createErrorLoggingResponseHandler(opLogger);
    op.setNodeEngine(nodeEngine).setPartitionId(partitionId).setReplicaIndex(replicaIndex).setOperationResponseHandler(responseHandler);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) ILogger(com.hazelcast.logging.ILogger) OperationResponseHandler(com.hazelcast.spi.OperationResponseHandler)

Aggregations

NodeEngine (com.hazelcast.spi.NodeEngine)75 Data (com.hazelcast.nio.serialization.Data)23 Address (com.hazelcast.nio.Address)14 ILogger (com.hazelcast.logging.ILogger)13 OperationService (com.hazelcast.spi.OperationService)9 IPartitionService (com.hazelcast.spi.partition.IPartitionService)9 Map (java.util.Map)7 Operation (com.hazelcast.spi.Operation)6 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)5 IPartition (com.hazelcast.spi.partition.IPartition)5 Member (com.hazelcast.core.Member)4 SenderTasklet (com.hazelcast.jet.impl.execution.SenderTasklet)4 Collection (java.util.Collection)4 AtomicReferenceContainer (com.hazelcast.concurrent.atomicreference.AtomicReferenceContainer)3 IFunction (com.hazelcast.core.IFunction)3 InternalPartitionServiceImpl (com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl)3 JetInstance (com.hazelcast.jet.JetInstance)3 JobConfig (com.hazelcast.jet.config.JobConfig)3 ProcessorSupplier (com.hazelcast.jet.core.ProcessorSupplier)3 Util.getJetInstance (com.hazelcast.jet.impl.util.Util.getJetInstance)3