Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 12. Managing with JMX > Managing services - Pg. 303

Managing services 303 12.3 Managing services The ServiceStateMBean can be used to retrieve information about all of the regis- tered services in the OSG i service registry. As you'll see, it works similarly to the Bun- dleStateMBean . Let's expand the previous example by finding all services that are being registered by the mybundle bundle, and then verify which bundles are using these services. This is illustrated in the next listing. Listing 12.3 Retrieving registered services long [] serviceIds = bundleStateMBean.getRegisteredServices(myBundleId); mbeanName = new ObjectName ("osgi.core:type=ServiceState,version=1.5"); b c Get all registered services ServiceStateMBean serviceStateMBean = JMX.newMBeanProxy(msc, mbeanName, ServiceStateMBean.class); for (long serviceId : serviceIds) { long [] bundleIds = serviceStateMBean.getUsingBundles(serviceId); System.out.println("The service '" + ServiceState MBean name d Get bundles using service