use of com.hazelcast.instance.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, nodeEngine.getSerializationService());
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.instance.MemberImpl in project hazelcast by hazelcast.
the class SerializationTest method testMemberLeftException_withLiteMemberImpl.
@Test
public void testMemberLeftException_withLiteMemberImpl() throws Exception {
String uuid = UuidUtil.newUnsecureUuidString();
String host = "127.0.0.1";
int port = 5000;
Member member = new MemberImpl(new Address(host, port), MemberVersion.of("3.8.0"), false, uuid, null, null, true);
testMemberLeftException(uuid, host, port, member);
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class SerializationTest method testMemberLeftException.
private void testMemberLeftException(String uuid, String host, int port, Member member) throws Exception {
MemberLeftException exception = new MemberLeftException(member);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(bout);
out.writeObject(exception);
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
ObjectInputStream in = new ObjectInputStream(bin);
MemberLeftException exception2 = (MemberLeftException) in.readObject();
MemberImpl member2 = (MemberImpl) exception2.getMember();
assertEquals(uuid, member2.getUuid());
assertEquals(host, member2.getAddress().getHost());
assertEquals(port, member2.getAddress().getPort());
assertEquals(member.isLiteMember(), member2.isLiteMember());
assertEquals(member.getVersion(), member2.getVersion());
}
use of com.hazelcast.instance.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.instance.MemberImpl in project hazelcast by hazelcast.
the class MapPublisherCreateMessageTask method createInvocations.
private void createInvocations(Collection<MemberImpl> members, List<Future> futures) {
final InternalOperationService operationService = nodeEngine.getOperationService();
final ClientEndpoint endpoint = getEndpoint();
for (MemberImpl member : members) {
Predicate predicate = serializationService.toObject(parameters.predicate);
AccumulatorInfo accumulatorInfo = AccumulatorInfo.createAccumulatorInfo(parameters.mapName, parameters.cacheName, predicate, parameters.batchSize, parameters.bufferSize, parameters.delaySeconds, false, parameters.populate, parameters.coalesce);
PublisherCreateOperation operation = new PublisherCreateOperation(accumulatorInfo);
operation.setCallerUuid(endpoint.getUuid());
Address address = member.getAddress();
InvocationBuilder invocationBuilder = operationService.createInvocationBuilder(SERVICE_NAME, operation, address);
Future future = invocationBuilder.invoke();
futures.add(future);
}
}
Aggregations