{
// we need an MBeanServer to store our network registry and multicast detector services
MBeanServer server = MBeanServerFactory.createMBeanServer();
// multicast detector will detect new network registries that come online
MulticastDetector detector = new MulticastDetector();
NetworkRegistry registry = NetworkRegistry.getInstance();
services.setup(server, detector, null, registry, null, true, true);
detector.start();
}
else
{
// the internal services singleton is already setup, but make sure it has the services we need
if (services.getDetector() == null)
{
MulticastDetector detector = new MulticastDetector();
services.assignDetector(detector, null, true);
detector.start();
}
if (services.getNetworkRegistry() == null)
{
NetworkRegistry registry = NetworkRegistry.getInstance();