Call the ComponentInstanceManager.listComponentInstances() method to list all component instances in the CAS Service. In this release, components are Record Store instances that are running in the CAS Service.
The syntax of the method is:
ComponentInstanceManager.listComponentInstances()
The method returns a list of ComponentInstanceDescriptor objects. Each ComponentInstanceDescriptor object represents a single component (that is, a Record Store instance) and is made up of the following:
TypeIdobject. This is the component type. For example, in this release, it is alwaysRecordStore.InstanceIdobject. This is the user-specified name of an instance.InstanceStatusobject. This is the status of a Record Store instance. This value can be one of the following constants:RUNNING,FAILED, orSTOPPED.
To list component instances:
Create a
ComponentInstanceManagerLocatorby callingcreate()and specify the host and port of the server running the Component Instance Manager. For example:ComponentInstanceManagerLocator locator = ComponentInstanceManagerLocator.create("localhost", 8500);Create a
ComponentInstanceManagerobject and callgetService()to establish a connection to the server and the Component Instance Manager service itself. For example:ComponentInstanceManager cim = locator.getService();
Call
listComponentInstances()and then create aforloop to loop over all component instances. Inside the loop, get theTypeId,InstanceId, andInstanceStatusand print them to system out (or elsewhere). For example:for (ComponentInstanceDescriptor desc : cim.listComponentInstances()) { System.out.println(desc.getInstanceId() + " of type " + desc.getTypeId() + " has status " + desc.getInstanceStatus()); }

