Search in sources :

Example 16 with NodeEngine

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

the class MapFlushMessageTask method call.

@Override
protected Object call() throws Exception {
    MapService mapService = getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    ProxyService proxyService = nodeEngine.getProxyService();
    DistributedObject distributedObject = proxyService.getDistributedObject(SERVICE_NAME, parameters.name);
    MapProxyImpl mapProxy = (MapProxyImpl) distributedObject;
    mapProxy.flush();
    return null;
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) DistributedObject(com.hazelcast.core.DistributedObject) ProxyService(com.hazelcast.spi.ProxyService) MapProxyImpl(com.hazelcast.map.impl.proxy.MapProxyImpl) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 17 with NodeEngine

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

the class AbstractCollectionProxyImpl method compareAndRemove.

private boolean compareAndRemove(boolean retain, Collection<?> c) {
    checkObjectNotNull(c);
    Set<Data> valueSet = new HashSet<Data>(c.size());
    final NodeEngine nodeEngine = getNodeEngine();
    for (Object o : c) {
        checkObjectNotNull(o);
        valueSet.add(nodeEngine.toData(o));
    }
    final CollectionCompareAndRemoveOperation operation = new CollectionCompareAndRemoveOperation(name, retain, valueSet);
    final Boolean result = invoke(operation);
    return result;
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) Data(com.hazelcast.nio.serialization.Data) AbstractDistributedObject(com.hazelcast.spi.AbstractDistributedObject) InitializingObject(com.hazelcast.spi.InitializingObject) CollectionCompareAndRemoveOperation(com.hazelcast.collection.impl.collection.operations.CollectionCompareAndRemoveOperation) HashSet(java.util.HashSet)

Example 18 with NodeEngine

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

the class AbstractCollectionProxyImpl method containsAll.

public boolean containsAll(Collection<?> c) {
    checkObjectNotNull(c);
    Set<Data> valueSet = new HashSet<Data>(c.size());
    final NodeEngine nodeEngine = getNodeEngine();
    for (Object o : c) {
        checkObjectNotNull(o);
        valueSet.add(nodeEngine.toData(o));
    }
    final CollectionContainsOperation operation = new CollectionContainsOperation(name, valueSet);
    final Boolean result = invoke(operation);
    return result;
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) Data(com.hazelcast.nio.serialization.Data) AbstractDistributedObject(com.hazelcast.spi.AbstractDistributedObject) InitializingObject(com.hazelcast.spi.InitializingObject) CollectionContainsOperation(com.hazelcast.collection.impl.collection.operations.CollectionContainsOperation) HashSet(java.util.HashSet)

Example 19 with NodeEngine

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

the class AlterOperation method run.

@Override
public void run() throws Exception {
    NodeEngine nodeEngine = getNodeEngine();
    IFunction f = nodeEngine.toObject(function);
    AtomicReferenceContainer reference = getReferenceContainer();
    Data originalData = reference.get();
    Object input = nodeEngine.toObject(originalData);
    //noinspection unchecked
    Object output = f.apply(input);
    Data serializedOutput = nodeEngine.toData(output);
    shouldBackup = !isEquals(originalData, serializedOutput);
    if (shouldBackup) {
        backup = serializedOutput;
        reference.set(backup);
    }
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) AtomicReferenceContainer(com.hazelcast.concurrent.atomicreference.AtomicReferenceContainer) Data(com.hazelcast.nio.serialization.Data) IFunction(com.hazelcast.core.IFunction)

Example 20 with NodeEngine

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

the class ApplyOperation method run.

@Override
public void run() throws Exception {
    NodeEngine nodeEngine = getNodeEngine();
    IFunction f = nodeEngine.toObject(function);
    AtomicReferenceContainer atomicReferenceContainer = getReferenceContainer();
    Object input = nodeEngine.toObject(atomicReferenceContainer.get());
    //noinspection unchecked
    Object output = f.apply(input);
    returnValue = nodeEngine.toData(output);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) AtomicReferenceContainer(com.hazelcast.concurrent.atomicreference.AtomicReferenceContainer) IFunction(com.hazelcast.core.IFunction)

Aggregations

NodeEngine (com.hazelcast.spi.NodeEngine)157 Data (com.hazelcast.nio.serialization.Data)50 OperationService (com.hazelcast.spi.OperationService)30 Address (com.hazelcast.nio.Address)20 ILogger (com.hazelcast.logging.ILogger)14 Operation (com.hazelcast.spi.Operation)14 Member (com.hazelcast.core.Member)12 Future (java.util.concurrent.Future)12 InternalCompletableFuture (com.hazelcast.spi.InternalCompletableFuture)11 IPartitionService (com.hazelcast.spi.partition.IPartitionService)11 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)10 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 AbstractDistributedObject (com.hazelcast.spi.AbstractDistributedObject)8 HazelcastInstance (com.hazelcast.core.HazelcastInstance)7 InternalPartitionServiceImpl (com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl)7 Config (com.hazelcast.config.Config)6 ArrayList (java.util.ArrayList)6