use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class QueueService method dispatchEvent.
@Override
public void dispatchEvent(QueueEvent event, ItemListener listener) {
final MemberImpl member = nodeEngine.getClusterService().getMember(event.caller);
ItemEvent itemEvent = new DataAwareItemEvent(event.name, event.eventType, event.data, member, serializationService);
if (member == null) {
if (logger.isInfoEnabled()) {
logger.info("Dropping event " + itemEvent + " from unknown address:" + event.caller);
}
return;
}
if (event.eventType.equals(ItemEventType.ADDED)) {
listener.itemAdded(itemEvent);
} else {
listener.itemRemoved(itemEvent);
}
getLocalQueueStatsImpl(event.name).incrementReceivedEvents();
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class ScheduledExecutorGetAllScheduledMessageTask method accumulateTaskHandlersAsUrnValues.
@SuppressWarnings("unchecked")
private void accumulateTaskHandlersAsUrnValues(List<ScheduledTaskHandler> accumulator, Map<?, ?> taskHandlersMap) {
ClusterService clusterService = nodeEngine.getClusterService();
IPartitionService partitionService = nodeEngine.getPartitionService();
for (Map.Entry<?, ?> entry : taskHandlersMap.entrySet()) {
MemberImpl owner;
Object key = entry.getKey();
if (key instanceof Number) {
owner = clusterService.getMember(partitionService.getPartitionOwner((Integer) key));
} else {
owner = (MemberImpl) key;
}
List<ScheduledTaskHandler> handlers = (List<ScheduledTaskHandler>) entry.getValue();
for (ScheduledTaskHandler handler : handlers) {
ScheduledTaskHandlerAccessor.setUuid(handler, owner.getUuid());
}
accumulator.addAll(handlers);
}
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class Node method mergeEnvironmentProvidedMemberMetadata.
private void mergeEnvironmentProvidedMemberMetadata() {
MemberImpl localMember = getLocalMember();
Map<String, String> metadata = discoveryService.discoverLocalMetadata();
for (Map.Entry<String, String> entry : metadata.entrySet()) {
Object value = entry.getValue();
localMember.setAttribute(entry.getKey(), value.toString());
}
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class TransactionImplTest method setup.
@Before
public void setup() {
HazelcastInstance hz = createHazelcastInstance();
operationService = getOperationService(hz);
logger = mock(ILogger.class);
txManagerService = mock(TransactionManagerServiceImpl.class);
nodeEngine = mock(NodeEngine.class);
when(nodeEngine.getOperationService()).thenReturn(operationService);
when(nodeEngine.getLocalMember()).thenReturn(new MemberImpl());
when(nodeEngine.getLogger(TransactionImpl.class)).thenReturn(logger);
options = new TransactionOptions().setTransactionType(ONE_PHASE);
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MemberImplConstructorTest method testConstructor.
@Test
public void testConstructor() {
HazelcastInstance hz = createHazelcastInstance();
MemberImpl memberImpl = (MemberImpl) hz.getCluster().getLocalMember();
MemberImplConstructor constructor = new MemberImplConstructor(MemberImpl.class);
MemberImpl clonedMemberImpl = (MemberImpl) constructor.createNew(memberImpl);
assertEquals(memberImpl.localMember(), clonedMemberImpl.localMember());
assertEquals(memberImpl.isLiteMember(), clonedMemberImpl.isLiteMember());
assertEquals(memberImpl.getAddress(), clonedMemberImpl.getAddress());
assertEquals(memberImpl.getSocketAddress(), clonedMemberImpl.getSocketAddress());
assertEquals(memberImpl.getUuid(), clonedMemberImpl.getUuid());
assertEquals(memberImpl.getAttributes(), clonedMemberImpl.getAttributes());
assertEquals(memberImpl.getVersion(), clonedMemberImpl.getVersion());
}
Aggregations