Troubleshooting
Problem
When running UM Java Admin API sample code as below to obtain usage counters for UM realm and UM channel, these counters are all returned with zero value. Same statistic counters are shown correctly in Enterprise Manager UI.
import com.pcbsys.nirvana.client.*;
import com.pcbsys.nirvana.nAdminAPI.*;
public class RealmStats
{
public static void main(String args[]) throws Exception
{
String REALM = "nsp://localhost:9000";
String CHANNEL = "mychannel";
nSessionAttributes sa = new nSessionAttributes(REALM);
nSession session = nSessionFactory.create(sa);
session.init();
nChannel nc = session.findChannel(new nChannelAttributes(CHANNEL));
nSessionFactory.close(session);
nRealmNode realm = new nRealmNode(sa);
realm.waitForEntireNameSpace();
nLeafNode leaf = (nLeafNode) realm.findNode(CHANNEL);
System.out.println("Realm URL : " + REALM);
System.out.println("Channel Name : " + CHANNEL);
System.out.println("Realm Usage Statistics:");
System.out.println("Memory allocated : " + realm.getTotalMemory() + " Bytes");
System.out.println("Total Connections : " + realm.getTotalConnections());
System.out.println("Free Memory : " + realm.getFreeMemory());
System.out.println("Channel Usage Statistics:");
System.out.println("Last EID : " + leaf.getLastEID());
System.out.println("Total Published : " + leaf.getTotalPublished());
System.out.println("Total Consumed : " + leaf.getTotalConsumed());
System.out.println("NumberOfEvents : " + leaf.getCurrentNumberOfEvents());
System.out.println("Free Space : " + leaf.getPercentageFreeInStore());
System.out.println("Used Space : " + leaf.getUsedSpace());
realm.close();
} // end main
} // end class
What is the problem here and how to fix it ?
Document Location
Worldwide
Log InLog in to view more of this document
Was this topic helpful?
Document Information
Modified date:
20 March 2025
UID
ibm17211323