Search in sources :

Example 31 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class MultiMapKeyValueSource method open.

@Override
public boolean open(NodeEngine nodeEngine) {
    NodeEngineImpl nei = (NodeEngineImpl) nodeEngine;
    IPartitionService ps = nei.getPartitionService();
    MultiMapService multiMapService = nei.getService(MultiMapService.SERVICE_NAME);
    ss = nei.getSerializationService();
    Address partitionOwner = ps.getPartitionOwner(partitionId);
    if (partitionOwner == null) {
        return false;
    }
    multiMapContainer = multiMapService.getOrCreateCollectionContainer(partitionId, multiMapName);
    isBinary = multiMapContainer.getConfig().isBinary();
    keyIterator = multiMapContainer.keySet().iterator();
    return true;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Address(com.hazelcast.nio.Address) IPartitionService(com.hazelcast.spi.partition.IPartitionService) MultiMapService(com.hazelcast.multimap.impl.MultiMapService)

Example 32 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class ParkedOperation method isCallTimedOut.

public boolean isCallTimedOut() {
    final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    InternalOperationService operationService = nodeEngine.getOperationService();
    if (operationService.isCallTimedOut(op)) {
        cancel(new CallTimeoutResponse(op.getCallId(), op.isUrgent()));
        return true;
    }
    return false;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) CallTimeoutResponse(com.hazelcast.spi.impl.operationservice.impl.responses.CallTimeoutResponse) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService)

Example 33 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class Backup method afterRun.

@Override
public void afterRun() throws Exception {
    if (!valid || !sync || getCallId() == 0 || originalCaller == null) {
        return;
    }
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    long callId = getCallId();
    OperationServiceImpl operationService = (OperationServiceImpl) nodeEngine.getOperationService();
    if (nodeEngine.getThisAddress().equals(originalCaller)) {
        operationService.getInboundResponseHandler().notifyBackupComplete(callId);
    } else {
        BackupAckResponse backupAckResponse = new BackupAckResponse(callId, backupOp.isUrgent());
        operationService.getOutboundResponseHandler().send(backupAckResponse, originalCaller);
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) BackupAckResponse(com.hazelcast.spi.impl.operationservice.impl.responses.BackupAckResponse) OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)

Example 34 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class PostJoinRegistrationOperation method run.

@Override
public void run() throws Exception {
    if (registrations == null || registrations.size() <= 0) {
        return;
    }
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    EventServiceImpl eventService = (EventServiceImpl) nodeEngine.getEventService();
    for (Registration reg : registrations) {
        eventService.handleRegistration(reg);
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Registration(com.hazelcast.spi.impl.eventservice.impl.Registration) EventServiceImpl(com.hazelcast.spi.impl.eventservice.impl.EventServiceImpl)

Example 35 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class InternalCacheRecordStoreTest method verifyPrimaryState.

private void verifyPrimaryState(Node node, String fullCacheName, int partitionId, boolean expectedState) throws Exception {
    NodeEngineImpl nodeEngine = node.getNodeEngine();
    InternalOperationService operationService = nodeEngine.getOperationService();
    Future<Boolean> isPrimaryOnNode = operationService.invokeOnTarget(ICacheService.SERVICE_NAME, createCacheOwnerStateGetterOperation(fullCacheName, partitionId), node.getThisAddress());
    assertEquals(expectedState, isPrimaryOnNode.get());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService)

Aggregations

NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)112 HazelcastInstance (com.hazelcast.core.HazelcastInstance)39 Test (org.junit.Test)32 ParallelTest (com.hazelcast.test.annotation.ParallelTest)31 QuickTest (com.hazelcast.test.annotation.QuickTest)31 Node (com.hazelcast.instance.Node)21 MapService (com.hazelcast.map.impl.MapService)20 Config (com.hazelcast.config.Config)19 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)19 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)16 MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)14 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)14 ILogger (com.hazelcast.logging.ILogger)11 AssertTask (com.hazelcast.test.AssertTask)11 Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)10 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)10 Address (com.hazelcast.nio.Address)10 Data (com.hazelcast.nio.serialization.Data)10 Before (org.junit.Before)10 Operation (com.hazelcast.spi.Operation)9