本文整理了Java中com.hazelcast.nio.Address.equals()
方法的一些代码示例,展示了Address.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.equals()
方法的具体详情如下:
包路径:com.hazelcast.nio.Address
类名称:Address
方法名:equals
暂无
代码示例来源:origin: hazelcast/hazelcast-jet
private void addAllFilterJobOwner(Set<Address> target, Set<Address> source) {
for (Address address : source) {
if (jobOwner.equals(address)) {
continue;
}
target.add(address);
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
private static int[] arrangeLocalPartitions(Address[] partitionOwners, Address thisAddress) {
return IntStream.range(0, partitionOwners.length)
.filter(partitionId -> thisAddress.equals(partitionOwners[partitionId]))
.toArray();
}
代码示例来源:origin: hazelcast/hazelcast-jet
private static Map<Address, int[]> remotePartitionAssignment(Address[] partitionOwners, Address thisAddress) {
Map<Address, List<Integer>> addrToPartitions = IntStream.range(0, partitionOwners.length)
.filter(partitionId -> !thisAddress.equals(partitionOwners[partitionId]))
.boxed()
.collect(groupingBy(partitionId -> partitionOwners[partitionId]));
return addrToPartitions.entrySet().stream().collect(toMap(
Map.Entry::getKey, e -> e.getValue().stream().mapToInt(x -> x).toArray()));
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
/**
* Returns {@code true} if local member is the caller.
* <p>
* <b>Note:</b> On the caller member this method always returns {@code
* true}. It's meant to be used on target member to determine if the
* execution is local.
*/
public boolean executedLocally() {
return nodeEngine.getThisAddress().equals(callerAddress);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public boolean isOwnerOrBackup(Address address) {
if (address == null) {
return false;
}
for (int i = 0; i < MAX_REPLICA_COUNT; i++) {
if (address.equals(getAddress(replicas[i]))) {
return true;
}
}
return false;
}
代码示例来源:origin: hazelcast/hazelcast-jet
public MemberInfo getMember(Address address) {
for (MemberInfo member : members) {
if (member.getAddress().equals(address)) {
return member;
}
}
return null;
}
代码示例来源:origin: hazelcast/hazelcast-jet
public boolean containsMember(Address address, String uuid) {
for (MemberInfo member : members) {
if (member.getAddress().equals(address)) {
return member.getUuid().equals(uuid);
}
}
return false;
}
代码示例来源:origin: hazelcast/hazelcast-jet
private boolean isMessageToSelf(JoinMessage joinMessage) {
Address thisAddress = node.getThisAddress();
return thisAddress == null || thisAddress.equals(joinMessage.getAddress());
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
/** Verifies that the local master is equal to the migration master. */
final void verifyMaster() {
NodeEngine nodeEngine = getNodeEngine();
Address masterAddress = nodeEngine.getMasterAddress();
if (!migrationInfo.getMaster().equals(masterAddress)) {
throw new IllegalStateException("Migration initiator is not master node! => " + toString());
}
if (getMigrationParticipantType() == MigrationParticipant.SOURCE && !masterAddress.equals(getCallerAddress())) {
throw new IllegalStateException("Caller is not master node! => " + toString());
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
private boolean isPrimary() {
final Address owner = nodeEngine.getPartitionService().getPartition(partitionId, false).getOwnerOrNull();
final Address thisAddress = nodeEngine.getThisAddress();
return owner != null && owner.equals(thisAddress);
}
代码示例来源:origin: hazelcast/hazelcast-jet
private boolean ensureValidBindTarget(TcpIpConnection connection, Address remoteEndPoint, Address localEndpoint,
Address thisAddress) {
if (ioService.isSocketBindAny() && !connection.isClient() && !thisAddress.equals(localEndpoint)) {
String msg = "Wrong bind request from " + remoteEndPoint
+ "! This node is not the requested endpoint: " + localEndpoint;
logger.warning(msg);
connection.close(msg, null);
return false;
}
return true;
}
代码示例来源:origin: hazelcast/hazelcast-jet
public void onMessage(Object msg) {
if (msg instanceof SplitBrainJoinMessage) {
SplitBrainJoinMessage joinRequest = (SplitBrainJoinMessage) msg;
Address thisAddress = node.getThisAddress();
// only master nodes execute the SplitBrainHandler that processes SplitBrainJoinMessages
if (!thisAddress.equals(joinRequest.getAddress()) && node.isMaster()) {
deque.addFirst(joinRequest);
}
}
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
private boolean isOwner() {
final NodeEngine nodeEngine = getNodeEngine();
final Address owner = nodeEngine.getPartitionService().getPartitionOwner(getPartitionId());
return nodeEngine.getThisAddress().equals(owner);
}
代码示例来源:origin: hazelcast/hazelcast-jet
private boolean isOwner() {
final NodeEngine nodeEngine = getNodeEngine();
final Address owner = nodeEngine.getPartitionService().getPartitionOwner(getPartitionId());
return nodeEngine.getThisAddress().equals(owner);
}
代码示例来源:origin: hazelcast/hazelcast-jet
public boolean handleRegistration(Registration reg) {
if (nodeEngine.getThisAddress().equals(reg.getSubscriber())) {
return false;
}
EventServiceSegment segment = getSegment(reg.getServiceName(), true);
return segment.addRegistration(reg.getTopic(), reg);
}
代码示例来源:origin: hazelcast/hazelcast-jet
void sendExplicitSuspicionTrigger(Address triggerTo, MembersViewMetadata endpointMembersViewMetadata) {
if (triggerTo.equals(node.getThisAddress())) {
logger.warning("Cannot send explicit suspicion trigger for " + endpointMembersViewMetadata + " to itself.");
return;
}
int memberListVersion = membershipManager.getMemberListVersion();
Operation op = new TriggerExplicitSuspicionOp(memberListVersion, endpointMembersViewMetadata);
OperationService operationService = nodeEngine.getOperationService();
operationService.send(op, triggerTo);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public Object getResponse() {
if (getNodeEngine().getThisAddress().equals(getCallerAddress())) {
return response;
} else {
return new NormalResponse(response, getCallId(), 1, isUrgent());
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
public JobSupervisor createJobSupervisor(JobTaskConfiguration configuration) {
// Job might already be cancelled (due to async processing)
NodeJobTracker jobTracker = (NodeJobTracker) createDistributedObject(configuration.getName());
if (jobTracker.unregisterJobSupervisorCancellation(configuration.getJobId())) {
return null;
}
JobSupervisorKey key = new JobSupervisorKey(configuration.getName(), configuration.getJobId());
boolean ownerNode = nodeEngine.getThisAddress().equals(configuration.getJobOwner());
JobSupervisor jobSupervisor = new JobSupervisor(configuration, jobTracker, ownerNode, this);
JobSupervisor oldSupervisor = jobSupervisors.putIfAbsent(key, jobSupervisor);
return oldSupervisor != null ? oldSupervisor : jobSupervisor;
}
代码示例来源:origin: hazelcast/hazelcast-jet
private MemberImpl createMember(MemberInfo memberInfo, Map<String, Object> attributes) {
Address address = memberInfo.getAddress();
Address thisAddress = node.getThisAddress();
String ipV6ScopeId = thisAddress.getScopeId();
address.setScopeId(ipV6ScopeId);
boolean localMember = thisAddress.equals(address);
return new MemberImpl(address, memberInfo.getVersion(), localMember, memberInfo.getUuid(), attributes,
memberInfo.isLiteMember(), memberInfo.getMemberListJoinVersion(), node.hazelcastInstance);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public void run() throws Exception {
service = getService();
ReplicatedRecordStore store = service.getReplicatedRecordStore(name, true, getPartitionId());
Object removed = store.remove(key);
oldValue = getNodeEngine().toData(removed);
response = new VersionResponsePair(removed, store.getVersion());
Address thisAddress = getNodeEngine().getThisAddress();
if (!getCallerAddress().equals(thisAddress)) {
sendUpdateCallerOperation(true);
}
}
内容来源于网络,如有侵权,请联系作者删除!