use of com.hazelcast.core.Member in project hazelcast by hazelcast.
the class MapEventPublishingService method dispatchMapPartitionLostEventData.
private void dispatchMapPartitionLostEventData(MapPartitionEventData eventData, ListenerAdapter listener) {
Member member = getMember(eventData);
MapPartitionLostEvent event = createMapPartitionLostEventData(eventData, member);
callListener(listener, event);
}
use of com.hazelcast.core.Member in project hazelcast by hazelcast.
the class MapEventPublishingService method dispatchMapEventData.
private void dispatchMapEventData(MapEventData mapEventData, ListenerAdapter listener) {
Member member = getMember(mapEventData);
MapEvent event = createMapEvent(mapEventData, member);
callListener(listener, event);
}
use of com.hazelcast.core.Member in project hazelcast by hazelcast.
the class SimpleMultiMapTest method load.
private static void load(boolean load, ExecutorService es, final MultiMap<String, byte[]> map) {
if (load) {
final Member thisMember = instance.getCluster().getLocalMember();
for (int i = 0; i < entryCount; i++) {
final String key = String.valueOf(i);
Partition partition = instance.getPartitionService().getPartition(key);
if (thisMember.equals(partition.getOwner())) {
es.execute(new Runnable() {
public void run() {
map.put(key, new byte[valueSize]);
}
});
}
}
}
}
use of com.hazelcast.core.Member in project hazelcast by hazelcast.
the class PartitionControlledIdTest method testObjectWithPartitionKeyAndMap.
@Test
public void testObjectWithPartitionKeyAndMap() throws Exception {
HazelcastInstance instance = instances[0];
IExecutorService executorServices = instance.getExecutorService("executor");
String partitionKey = "hazelcast";
String mapKey = "key@" + partitionKey;
IMap map = instance.getMap("map");
map.put(mapKey, "foobar");
ISemaphore semaphore = instance.getSemaphore("s@" + partitionKey);
semaphore.release();
ContainsSemaphoreAndMapEntryTask task = new ContainsSemaphoreAndMapEntryTask(semaphore.getName(), mapKey);
Map<Member, Future<Boolean>> futures = executorServices.submitToAllMembers(task);
int count = 0;
for (Future<Boolean> f : futures.values()) {
count += f.get() ? 1 : 0;
}
assertEquals(1, count);
}
use of com.hazelcast.core.Member in project hazelcast by hazelcast.
the class SimpleReplicatedMapTest method load.
private void load(ExecutorService es) throws InterruptedException {
if (!load) {
return;
}
final ReplicatedMap<String, Object> map = instance.getReplicatedMap(NAMESPACE);
final Member thisMember = instance.getCluster().getLocalMember();
List<String> lsOwnedEntries = new LinkedList<String>();
for (int i = 0; i < entryCount; i++) {
final String key = String.valueOf(i);
Partition partition = instance.getPartitionService().getPartition(key);
if (thisMember.equals(partition.getOwner())) {
lsOwnedEntries.add(key);
}
}
final CountDownLatch latch = new CountDownLatch(lsOwnedEntries.size());
for (final String ownedKey : lsOwnedEntries) {
es.execute(new Runnable() {
public void run() {
map.put(ownedKey, createValue());
latch.countDown();
}
});
}
latch.await();
}
Aggregations