use of com.hazelcast.version.MemberVersion in project hazelcast by hazelcast.
the class ClusterJoinManager method setAsMaster.
public boolean setAsMaster() {
clusterServiceLock.lock();
try {
if (node.joined()) {
logger.warning("Cannot set as master because node is already joined!");
return false;
}
logger.finest("This node is being set as the master");
Address thisAddress = node.getThisAddress();
MemberVersion version = node.getVersion();
node.setMasterAddress(thisAddress);
if (clusterService.getClusterVersion().isUnknown()) {
clusterService.getClusterStateManager().setClusterVersion(version.asVersion());
}
clusterService.getClusterClock().setClusterStartTime(Clock.currentTimeMillis());
clusterService.setClusterId(UuidUtil.createClusterUuid());
node.setJoined();
return true;
} finally {
clusterServiceLock.unlock();
}
}
use of com.hazelcast.version.MemberVersion in project hazelcast by hazelcast.
the class MemberSelectingIteratorTest method before.
@Before
public void before() throws Exception {
MemberVersion version = new MemberVersion(BuildInfoProvider.BUILD_INFO.getVersion());
thisMember = new MemberImpl(new Address("localhost", 5701), version, true, true);
matchingMember = new MemberImpl(new Address("localhost", 5702), version, false, true);
matchingMember2 = new MemberImpl(new Address("localhost", 5703), version, false, true);
nonMatchingMember = new MemberImpl(new Address("localhost", 5704), version, false, false);
}
use of com.hazelcast.version.MemberVersion in project hazelcast by hazelcast.
the class DefaultNodeExtensionTest method test_joinRequestFails_whenOtherMinorVersion.
@Test
public void test_joinRequestFails_whenOtherMinorVersion() throws UnknownHostException {
MemberVersion otherPatchVersion = MemberVersion.of(node.getVersion().getMajor(), node.getVersion().getMinor() + 1, node.getVersion().getPatch());
JoinRequest joinRequest = new JoinRequest(Packet.VERSION, BUILD_INFO.getBuildNumber(), otherPatchVersion, new Address("127.0.0.1", 9999), UuidUtil.newUnsecureUuidString(), false, null, null, null, null);
expected.expect(VersionMismatchException.class);
nodeExtension.validateJoinRequest(joinRequest);
}
use of com.hazelcast.version.MemberVersion in project hazelcast by hazelcast.
the class DefaultNodeExtensionTest method test_joinRequestAllowed_whenOtherPatchVersion.
@Test
public void test_joinRequestAllowed_whenOtherPatchVersion() throws UnknownHostException {
MemberVersion otherPatchVersion = MemberVersion.of(node.getVersion().getMajor(), node.getVersion().getMinor(), node.getVersion().getPatch() + 1);
JoinRequest joinRequest = new JoinRequest(Packet.VERSION, BUILD_INFO.getBuildNumber(), otherPatchVersion, new Address("127.0.0.1", 9999), UuidUtil.newUnsecureUuidString(), false, null, null, null, null);
nodeExtension.validateJoinRequest(joinRequest);
}
use of com.hazelcast.version.MemberVersion in project hazelcast by hazelcast.
the class DefaultNodeExtensionTest method test_joinRequestFails_whenOtherMajorVersion.
@Test
public void test_joinRequestFails_whenOtherMajorVersion() throws UnknownHostException {
MemberVersion otherPatchVersion = MemberVersion.of(node.getVersion().getMajor() + 1, node.getVersion().getMinor(), node.getVersion().getPatch());
JoinRequest joinRequest = new JoinRequest(Packet.VERSION, BUILD_INFO.getBuildNumber(), otherPatchVersion, new Address("127.0.0.1", 9999), UuidUtil.newUnsecureUuidString(), false, null, null, null, null);
expected.expect(VersionMismatchException.class);
nodeExtension.validateJoinRequest(joinRequest);
}
Aggregations