Search in sources :

Example 46 with NodeEngine

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

the class ObjectMultiMapProxy method isLocked.

@Override
public boolean isLocked(K key) {
    checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
    final NodeEngine nodeEngine = getNodeEngine();
    Data dataKey = nodeEngine.toData(key);
    return lockSupport.isLocked(nodeEngine, dataKey);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) Data(com.hazelcast.nio.serialization.Data)

Example 47 with NodeEngine

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

the class ObjectMultiMapProxy method unlock.

@Override
public void unlock(K key) {
    checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
    final NodeEngine nodeEngine = getNodeEngine();
    Data dataKey = nodeEngine.toData(key);
    lockSupport.unlock(nodeEngine, dataKey);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) Data(com.hazelcast.nio.serialization.Data)

Example 48 with NodeEngine

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

the class ObjectMultiMapProxy method initialize.

@Override
public void initialize() {
    final NodeEngine nodeEngine = getNodeEngine();
    List<EntryListenerConfig> listenerConfigs = config.getEntryListenerConfigs();
    for (EntryListenerConfig listenerConfig : listenerConfigs) {
        EntryListener listener = null;
        if (listenerConfig.getImplementation() != null) {
            listener = listenerConfig.getImplementation();
        } else if (listenerConfig.getClassName() != null) {
            try {
                listener = ClassLoaderUtil.newInstance(nodeEngine.getConfigClassLoader(), listenerConfig.getClassName());
            } catch (Exception e) {
                throw ExceptionUtil.rethrow(e);
            }
        }
        if (listener != null) {
            if (listener instanceof HazelcastInstanceAware) {
                ((HazelcastInstanceAware) listener).setHazelcastInstance(nodeEngine.getHazelcastInstance());
            }
            if (listenerConfig.isLocal()) {
                addLocalEntryListener(listener);
            } else {
                addEntryListener(listener, listenerConfig.isIncludeValue());
            }
        }
    }
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) EntryListener(com.hazelcast.core.EntryListener) HazelcastInstanceAware(com.hazelcast.core.HazelcastInstanceAware) HazelcastException(com.hazelcast.core.HazelcastException)

Example 49 with NodeEngine

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

the class ObjectMultiMapProxy method get.

@Override
public Collection<V> get(K key) {
    checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
    final NodeEngine nodeEngine = getNodeEngine();
    Data dataKey = nodeEngine.toData(key);
    MultiMapResponse result = getAllInternal(dataKey);
    return result.getObjectCollection(nodeEngine);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) MultiMapResponse(com.hazelcast.multimap.impl.operations.MultiMapResponse) Data(com.hazelcast.nio.serialization.Data)

Example 50 with NodeEngine

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

the class ObjectMultiMapProxy method values.

@Override
public Collection<V> values() {
    final NodeEngine nodeEngine = getNodeEngine();
    Map map = valuesInternal();
    Collection values = new LinkedList();
    for (Object obj : map.values()) {
        if (obj == null) {
            continue;
        }
        MultiMapResponse response = nodeEngine.toObject(obj);
        values.addAll(response.getObjectCollection(nodeEngine));
    }
    return values;
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) MultiMapResponse(com.hazelcast.multimap.impl.operations.MultiMapResponse) Collection(java.util.Collection) InitializingObject(com.hazelcast.spi.InitializingObject) MultiMap(com.hazelcast.core.MultiMap) Map(java.util.Map) LinkedList(java.util.LinkedList)

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