本文整理了Java中com.hazelcast.core.Member.getUuid()
方法的一些代码示例,展示了Member.getUuid()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Member.getUuid()
方法的具体详情如下:
包路径:com.hazelcast.core.Member
类名称:Member
方法名:getUuid
[英]Returns the UUID of this member.
[中]返回此成员的UUID。
代码示例来源:origin: SonarSource/sonarqube
@Override
public Optional<String> getLeaderHostName() {
String leaderId = (String) hzMember.getAtomicReference(LEADER).get();
if (leaderId != null) {
Optional<Member> leader = hzMember.getCluster().getMembers().stream().filter(m -> m.getUuid().equals(leaderId)).findFirst();
if (leader.isPresent()) {
return Optional.of(leader.get().getAddress().getHost());
}
}
return Optional.empty();
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public void memberRemoved(MembershipEvent membershipEvent) {
removeOperationalProcess(membershipEvent.getMember().getUuid());
}
代码示例来源:origin: SonarSource/sonarqube
private static Member newMember(String uuid) {
Member member = mock(Member.class);
when(member.getUuid()).thenReturn(uuid);
when(member.getStringAttribute(NODE_NAME.getKey())).thenReturn(uuid);
return member;
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public Member getMember(String uuid) {
final Collection<Member> memberList = getMemberList();
for (Member member : memberList) {
if (uuid.equals(member.getUuid())) {
return member;
}
}
return null;
}
代码示例来源:origin: hazelcast/hazelcast-jet
private void ensureMemberExist(Member member) {
if (!addressToMemberMap.containsKey(member.getAddress())) {
throw new IllegalArgumentException(member + " not found!");
}
if (!uuidToMemberMap.containsKey(member.getUuid())) {
throw new IllegalArgumentException(member + " not found!");
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public Operation getPreJoinOperation() {
Set<Member> members = nodeEngine.getClusterService().getMembers();
HashSet<String> liveMemberUUIDs = new HashSet<String>();
for (Member member : members) {
liveMemberUUIDs.add(member.getUuid());
}
Map<String, String> liveMappings = new HashMap<String, String>(ownershipMappings);
liveMappings.values().retainAll(liveMemberUUIDs);
return liveMappings.isEmpty() ? null : new OnJoinClientOperation(liveMappings);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
/**
* Return the name of the current Hazelcast instance.
*/
@Override
public String call() throws Exception {
String uuid = hazelcastInstance.getCluster().getLocalMember().getUuid();
log.info("call() runs on {}", uuid);
return uuid;
}
代码示例来源:origin: hazelcast/hazelcast-jet
private void writeObject(ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
Address address = member.getAddress();
String host = address.getHost();
int port = address.getPort();
out.writeUTF(member.getUuid());
out.writeUTF(host);
out.writeInt(port);
out.writeBoolean(member.isLiteMember());
out.writeObject(member.getVersion());
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public void memberRemoved(MembershipEvent membershipEvent) {
Member member = membershipEvent.getMember();
String uuid = member.getUuid();
handleDisconnectedSubscriber(uuid);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public void memberAdded(MembershipEvent membershipEvent) {
Member member = membershipEvent.getMember();
String uuid = member.getUuid();
handleConnectedSubscriber(uuid);
}
});
代码示例来源:origin: hazelcast/hazelcast-jet
public static void encode(Member member, ClientMessage clientMessage) {
AddressCodec.encode(member.getAddress(), clientMessage);
clientMessage.set(member.getUuid());
clientMessage.set(member.isLiteMember());
Map<String, Object> attributes = new HashMap<String, Object>(member.getAttributes());
clientMessage.set(attributes.size());
for (Map.Entry<String, Object> entry : attributes.entrySet()) {
clientMessage.set(entry.getKey());
Object value = entry.getValue();
clientMessage.set(value.toString());
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
/**
* @see com.hazelcast.map.impl.MapRemoteService#destroyDistributedObject(String)
*/
@Override
public boolean destroyNearCache(String mapName) {
invalidator.destroy(mapName, nodeEngine.getLocalMember().getUuid());
return super.destroyNearCache(mapName);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public void partitionLost(CachePartitionLostEvent event) {
if (endpoint.isAlive()) {
ClientMessage eventMessage =
CacheAddPartitionLostListenerCodec.encodeCachePartitionLostEvent(event.getPartitionId(),
event.getMember().getUuid());
sendClientMessage(null, eventMessage);
}
}
};
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public void partitionLost(MapPartitionLostEvent event) {
if (endpoint.isAlive()) {
ClientMessage eventMessage =
MapAddPartitionLostListenerCodec.encodeMapPartitionLostEvent(event.getPartitionId(),
event.getMember().getUuid());
sendClientMessage(null, eventMessage);
}
}
};
代码示例来源:origin: hazelcast/hazelcast-jet
private Address getMemberAddress(Member member) {
Member m = getContext().getClusterService().getMember(member.getUuid());
if (m == null) {
throw new HazelcastException(member + " is not available!");
}
return m.getAddress();
}
代码示例来源:origin: hazelcast/hazelcast-jet
public String addNearCacheInvalidationListener(InvalidationListener listener) {
// local member UUID may change after a split-brain merge
String localMemberUuid = getNodeEngine().getClusterService().getLocalMember().getUuid();
EventFilter eventFilter = new UuidFilter(localMemberUuid);
return mapServiceContext.addEventListener(listener, eventFilter, name);
}
代码示例来源:origin: hazelcast/hazelcast-jet
public XATransaction(NodeEngine nodeEngine, Xid xid, String txOwnerUuid, int timeout, boolean originatedFromClient) {
this.nodeEngine = nodeEngine;
this.transactionLog = new TransactionLog();
this.timeoutMillis = SECONDS.toMillis(timeout);
this.txnId = UuidUtil.newUnsecureUuidString();
this.xid = new SerializableXID(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier());
this.txOwnerUuid = txOwnerUuid == null ? nodeEngine.getLocalMember().getUuid() : txOwnerUuid;
ILogger logger = nodeEngine.getLogger(getClass());
this.commitExceptionHandler = logAllExceptions(logger, "Error during commit!", Level.WARNING);
this.rollbackExceptionHandler = logAllExceptions(logger, "Error during rollback!", Level.WARNING);
this.originatedFromClient = originatedFromClient;
}
代码示例来源:origin: hazelcast/hazelcast-jet
private void destroyCacheOnAllMembers(String name, String callerUuid) {
NodeEngine nodeEngine = getNodeEngine();
OperationService operationService = nodeEngine.getOperationService();
Collection<Member> members = nodeEngine.getClusterService().getMembers();
for (Member member : members) {
if (!member.localMember() && !member.getUuid().equals(callerUuid)) {
CacheDestroyOperation op = new CacheDestroyOperation(name, true);
operationService.invokeOnTarget(ICacheService.SERVICE_NAME, op, member.getAddress());
}
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
protected Operation newPrimaryExpiryOp(int expirationPercentage, PartitionContainer container) {
int partitionId = container.getPartitionId();
return new ClearExpiredOperation(expirationPercentage)
.setNodeEngine(nodeEngine)
.setCallerUuid(nodeEngine.getLocalMember().getUuid())
.setPartitionId(partitionId)
.setValidateTarget(false)
.setServiceName(SERVICE_NAME);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Test
public void test_cluster() {
// When
run("cluster");
// Then
String actual = captureOut();
assertContains(actual, jet.getCluster().getLocalMember().getUuid());
assertContains(actual, "ACTIVE");
}
内容来源于网络,如有侵权,请联系作者删除!