Search in sources :

Example 1 with RemoteServiceDescriptor

use of com.hazelcast.spi.impl.servicemanager.RemoteServiceDescriptor in project hazelcast by hazelcast.

the class ServiceManagerImpl method readServiceDescriptors.

private void readServiceDescriptors() {
    Node node = nodeEngine.getNode();
    try {
        ClassLoader classLoader = node.getConfigClassLoader();
        Iterator<Class<RemoteServiceDescriptorProvider>> iter = com.hazelcast.util.ServiceLoader.classIterator(PROVIDER_ID, classLoader);
        while (iter.hasNext()) {
            Class<RemoteServiceDescriptorProvider> clazz = iter.next();
            Constructor<RemoteServiceDescriptorProvider> constructor = clazz.getDeclaredConstructor();
            RemoteServiceDescriptorProvider provider = constructor.newInstance();
            RemoteServiceDescriptor[] services = provider.createRemoteServiceDescriptors();
            for (RemoteServiceDescriptor serviceDescriptor : services) {
                registerService(serviceDescriptor.getServiceName(), serviceDescriptor.getService(nodeEngine));
            }
        }
    } catch (Exception e) {
        throw ExceptionUtil.rethrow(e);
    }
}
Also used : RemoteServiceDescriptorProvider(com.hazelcast.spi.impl.servicemanager.RemoteServiceDescriptorProvider) Node(com.hazelcast.instance.Node) RemoteServiceDescriptor(com.hazelcast.spi.impl.servicemanager.RemoteServiceDescriptor) HazelcastException(com.hazelcast.core.HazelcastException)

Aggregations

HazelcastException (com.hazelcast.core.HazelcastException)1 Node (com.hazelcast.instance.Node)1 RemoteServiceDescriptor (com.hazelcast.spi.impl.servicemanager.RemoteServiceDescriptor)1 RemoteServiceDescriptorProvider (com.hazelcast.spi.impl.servicemanager.RemoteServiceDescriptorProvider)1