use of com.hazelcast.client.impl.management.MCClusterMetadata 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.management.MCClusterMetadata 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.management.MCClusterMetadata in project hazelcast by hazelcast.
the class HazelcastCommandLine method getClusterMetadata.
protected static CompletableFuture<MCClusterMetadata> getClusterMetadata(HazelcastClientInstanceImpl client, Member member) {
checkNotNull(member);
ClientInvocation invocation = new ClientInvocation(client, MCGetClusterMetadataCodec.encodeRequest(), null, member.getUuid());
return new ClientDelegatingFuture<>(invocation.invoke(), client.getSerializationService(), clientMessage -> {
MCGetClusterMetadataCodec.ResponseParameters response = MCGetClusterMetadataCodec.decodeResponse(clientMessage);
MCClusterMetadata metadata = new MCClusterMetadata();
metadata.setCurrentState(ClusterState.getById(response.currentState));
metadata.setClusterTime(response.clusterTime);
metadata.setMemberVersion(response.memberVersion);
return metadata;
});
}
use of com.hazelcast.client.impl.management.MCClusterMetadata 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.management.MCClusterMetadata in project hazelcast by hazelcast.
the class GetClusterMetadataMessageTask method call.
@Override
protected Object call() throws Exception {
MCClusterMetadata metadata = new MCClusterMetadata();
metadata.setCurrentState(nodeEngine.getClusterService().getClusterState());
metadata.setMemberVersion(BuildInfoProvider.getBuildInfo().getVersion());
metadata.setClusterTime(nodeEngine.getClusterService().getClusterTime());
return metadata;
}
Aggregations