In Java what is the best way to list all the namespaces and sets

In Java what is the best way to list all the namespaces and sets? The information is available using the asinfo command, but we need to be able to programmatically do this and I don’t see these functions available in the java client.

Thanks, Douglas

Hi Doug

Packaged with the Java Client is the Info class. Using the request() method you can send an “asinfo” message to a node in the cluster.

For example, if you want to see the sets, you can use this:

String answer = Info.request(infoPolicy, client.getNodes()[0], "sets");

Where “client.getNodes()[0]” is the first node in the cluster list stored in the client.

Show namespaces would be:

String answer = Info.request(infoPolicy, client.getNodes()[0], "namespaces");

Using Info.request(…) you can get the same information as asinfo.

I hope this helps

Thanks Peter. That should do the trick!

Hi Peter, Does Info guarantees accurate value for n_objects ?

I mean if I add row-X to node-1 and if immediately I query to node-2 then would count from node-1 take into account row-X ? If no, then how to get up-to-date count immediately ?

Regards Sameer

Yes. The nodes exchange information when the info command is issued.