use of com.hazelcast.client.impl.spi.ClientClusterService in project hazelcast by hazelcast.
the class ClientConsoleApp method startPrompt.
private static String startPrompt(HazelcastInstance hz) {
HazelcastClientInstanceImpl hazelcastClientImpl = getHazelcastClientInstanceImpl(hz);
ClientClusterService clientClusterService = hazelcastClientImpl.getClientClusterService();
MCClusterMetadata clusterMetadata = FutureUtil.getValue(getClusterMetadata(hazelcastClientImpl, clientClusterService.getMasterMember()));
Cluster cluster = hazelcastClientImpl.getCluster();
Set<Member> members = cluster.getMembers();
String versionString = "Hazelcast " + clusterMetadata.getMemberVersion();
return new StringBuilder().append("Hazelcast Console Application has started.\n").append("Connected to ").append(versionString).append(" at ").append(members.iterator().next().getAddress().toString()).append(" (+").append(members.size() - 1).append(" more)\n").append("Type 'help' for instructions").toString();
}
use of com.hazelcast.client.impl.spi.ClientClusterService in project hazelcast by hazelcast.
the class HazelcastCommandLine method cluster.
@Command(description = "Shows current cluster state and information about members")
public void cluster(@Mixin(name = "verbosity") Verbosity verbosity, @Mixin(name = "targets") TargetsMixin targets) {
runWithHazelcast(targets, verbosity, false, hz -> {
HazelcastClientInstanceImpl hazelcastClientImpl = getHazelcastClientInstanceImpl(hz);
ClientClusterService clientClusterService = hazelcastClientImpl.getClientClusterService();
MCClusterMetadata clusterMetadata = FutureUtil.getValue(getClusterMetadata(hazelcastClientImpl, clientClusterService.getMasterMember()));
Cluster cluster = hazelcastClientImpl.getCluster();
println("State: " + clusterMetadata.getCurrentState());
println("Version: " + clusterMetadata.getMemberVersion());
println("Size: " + cluster.getMembers().size());
println("");
String format = "%-24s %-19s";
printf(format, "ADDRESS", "UUID");
cluster.getMembers().forEach(member -> printf(format, member.getAddress(), member.getUuid()));
});
}
use of com.hazelcast.client.impl.spi.ClientClusterService in project hazelcast by hazelcast.
the class SqlConsole method sqlStartingPrompt.
private static String sqlStartingPrompt(HazelcastInstance hz) {
HazelcastClientInstanceImpl hazelcastClientImpl = getHazelcastClientInstanceImpl(hz);
ClientClusterService clientClusterService = hazelcastClientImpl.getClientClusterService();
MCClusterMetadata clusterMetadata = FutureUtil.getValue(getClusterMetadata(hazelcastClientImpl, clientClusterService.getMasterMember()));
Cluster cluster = hazelcastClientImpl.getCluster();
Set<Member> members = cluster.getMembers();
String versionString = "Hazelcast " + clusterMetadata.getMemberVersion();
return new AttributedStringBuilder().style(AttributedStyle.BOLD.foreground(PRIMARY_COLOR)).append("Connected to ").append(versionString).append(" at ").append(members.iterator().next().getAddress().toString()).append(" (+").append(String.valueOf(members.size() - 1)).append(" more)\n").append("Type 'help' for instructions").toAnsi();
}
use of com.hazelcast.client.impl.spi.ClientClusterService in project hazelcast by hazelcast.
the class ClientClusterServiceMemberListTest method testLiteMembers.
@Test
public void testLiteMembers() {
assertTrueEventually(() -> {
final ClientClusterService clusterService = getClientClusterService(client);
final Collection<Member> members = clusterService.getMembers(LITE_MEMBER_SELECTOR);
verifyMembers(members, singletonList(liteInstance));
assertEquals(1, clusterService.getMembers(LITE_MEMBER_SELECTOR).size());
});
}
use of com.hazelcast.client.impl.spi.ClientClusterService in project hazelcast by hazelcast.
the class ClientClusterServiceMemberListTest method testDataMembers.
@Test
public void testDataMembers() {
assertTrueEventually(() -> {
final ClientClusterService clusterService = getClientClusterService(client);
final Collection<Member> members = clusterService.getMembers(DATA_MEMBER_SELECTOR);
verifyMembers(members, asList(dataInstance, dataInstance2));
assertEquals(2, clusterService.getMembers(DATA_MEMBER_SELECTOR).size());
});
}
Aggregations