use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class ClusterServiceImpl method getMasterMember.
private MemberImpl getMasterMember() {
MemberImpl master;
lock.lock();
try {
Address masterAddress = getMasterAddress();
if (masterAddress == null) {
throw new IllegalStateException("Master is not known yet!");
}
master = getMember(masterAddress);
} finally {
lock.unlock();
}
return master;
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class JoinMessage method readData.
@Override
public void readData(ObjectDataInput in) throws IOException {
packetVersion = in.readByte();
buildNumber = in.readInt();
memberVersion = in.readObject();
address = in.readObject();
uuid = UUIDSerializationUtil.readUUID(in);
configCheck = in.readObject();
liteMember = in.readBoolean();
int memberCount = in.readInt();
memberAddresses = new ArrayList<>(memberCount);
for (int i = 0; i < memberCount; i++) {
Address address = in.readObject();
memberAddresses.add(address);
}
dataMemberCount = in.readInt();
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class JoinMessage method writeData.
@Override
public void writeData(ObjectDataOutput out) throws IOException {
out.writeByte(packetVersion);
out.writeInt(buildNumber);
out.writeObject(memberVersion);
out.writeObject(address);
UUIDSerializationUtil.writeUUID(out, uuid);
out.writeObject(configCheck);
out.writeBoolean(liteMember);
int memberCount = getMemberCount();
out.writeInt(memberCount);
if (memberCount > 0) {
for (Address address : memberAddresses) {
out.writeObject(address);
}
}
out.writeInt(dataMemberCount);
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class MemberHandshake method readData.
@Override
public void readData(ObjectDataInput in) throws IOException {
schemaVersion = in.readByte();
targetAddress = in.readObject();
reply = in.readBoolean();
uuid = readUUID(in);
int size = in.readInt();
if (size == 0) {
localAddresses = Collections.emptyMap();
} else {
Map<ProtocolType, Collection<Address>> addressesPerProtocolType = new EnumMap<>(ProtocolType.class);
for (int i = 0; i < size; i++) {
ProtocolType protocolType = ProtocolType.valueOf(in.readInt());
Collection<Address> addresses = readCollection(in);
addressesPerProtocolType.put(protocolType, addresses);
}
this.localAddresses = addressesPerProtocolType;
}
if (schemaVersion > SCHEMA_VERSION_1) {
int optionsSize = in.readInt();
for (int k = 0; k < optionsSize; k++) {
options.put(in.readString(), in.readString());
}
}
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class MulticastJoiner method joinMaster.
private void joinMaster() {
long maxMasterJoinTime = getMaxJoinTimeToMasterNode();
long start = Clock.currentTimeMillis();
while (shouldRetry() && Clock.currentTimeMillis() - start < maxMasterJoinTime) {
Address master = clusterService.getMasterAddress();
if (master != null) {
if (logger.isFineEnabled()) {
logger.fine("Joining to master " + master);
}
clusterJoinManager.sendJoinRequest(master);
} else {
break;
}
try {
clusterService.blockOnJoin(JOIN_RETRY_INTERVAL);
} catch (InterruptedException e) {
currentThread().interrupt();
}
if (isBlacklisted(master)) {
clusterService.setMasterAddressToJoin(null);
return;
}
}
}
Aggregations