use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class MemberMap method cloneExcluding.
/**
* Creates clone of source {@code MemberMap}, excluding given members.
* If source is empty, same map instance will be returned. If excluded members are empty or not present in
* source, a new map will be created containing the same members with source.
*
* @param source source map
* @param excludeMembers members to exclude
* @return clone map
*/
static MemberMap cloneExcluding(MemberMap source, MemberImpl... excludeMembers) {
if (source.size() == 0) {
return source;
}
Map<Address, MemberImpl> addressMap = new LinkedHashMap<Address, MemberImpl>(source.addressToMemberMap);
Map<String, MemberImpl> uuidMap = new LinkedHashMap<String, MemberImpl>(source.uuidToMemberMap);
for (MemberImpl member : excludeMembers) {
MemberImpl removed = addressMap.remove(member.getAddress());
if (removed != null) {
uuidMap.remove(removed.getUuid());
}
removed = uuidMap.remove(member.getUuid());
if (removed != null) {
addressMap.remove(removed.getAddress());
}
}
return new MemberMap(addressMap, uuidMap);
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class TransactionManagerServiceImpl method memberRemoved.
@Override
public void memberRemoved(MembershipServiceEvent event) {
MemberImpl member = event.getMember();
final String uuid = member.getUuid();
if (nodeEngine.isRunning()) {
logger.info("Committing/rolling-back alive transactions of " + member + ", UUID: " + uuid);
nodeEngine.getExecutionService().execute(ExecutionService.SYSTEM_EXECUTOR, new Runnable() {
@Override
public void run() {
finalizeTransactionsOf(uuid);
}
});
} else if (logger.isFinestEnabled()) {
logger.finest("Will not commit/roll-back transactions of " + member + ", UUID: " + uuid + " because this member is not running");
}
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class ReliableMessageListenerRunner method toMessage.
private Message<E> toMessage(ReliableTopicMessage m) {
MemberImpl member = clusterService.getMember(m.getPublisherAddress());
E payload = serializationService.toObject(m.getPayload());
return new Message<E>(topicName, payload, m.getPublishTime(), member);
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class SerializationTest method testMemberLeftException_usingMemberImpl.
@Test
public void testMemberLeftException_usingMemberImpl() 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);
testMemberLeftException(uuid, host, port, member);
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class TransactionImpl_OnePhaseTest method setup.
@Before
public void setup() {
HazelcastInstance hz = createHazelcastInstance();
operationService = getOperationService(hz);
logger = mock(ILogger.class);
txManagerService = mock(TransactionManagerServiceImpl.class);
txManagerService.commitCount = MwCounter.newMwCounter();
txManagerService.startCount = MwCounter.newMwCounter();
txManagerService.rollbackCount = MwCounter.newMwCounter();
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);
}
Aggregations