Search in sources :

Example 1 with ServiceRegistryConfig

use of io.servicecomb.serviceregistry.config.ServiceRegistryConfig in project java-chassis by ServiceComb.

the class RegistryThread method doInit.

public void doInit() {
    ServiceRegistryConfig serviceRegistryConfig = ServiceRegistryConfig.INSTANCE;
    try {
        if (isEmpty(RegistryUtils.getMicroservice().getServiceId())) {
            RegistryUtils.ensureRegisterMicroservice();
        }
        if (isEmpty(RegistryUtils.getMicroserviceInstance().getInstanceId())) {
            RegistryUtils.ensureRegisterInstance();
        }
        // 初始化client发现SR的动态集群扩容能力
        if (serviceRegistryConfig.isRegistryAutoDiscovery()) {
            IpPortManager.INSTANCE.createServiceRegistryCache();
        }
    } catch (TimerException e) {
        RegistryUtils.exception(e);
        return;
    }
    registerSuccess = true;
    NotifyManager.INSTANCE.notify(RegistryEvent.INITIALIZED, null);
}
Also used : ServiceRegistryConfig(io.servicecomb.serviceregistry.config.ServiceRegistryConfig) TimerException(io.servicecomb.serviceregistry.utils.TimerException)

Aggregations

ServiceRegistryConfig (io.servicecomb.serviceregistry.config.ServiceRegistryConfig)1 TimerException (io.servicecomb.serviceregistry.utils.TimerException)1