Search in sources :

Example 1 with SuppressedRunnableWrapper

use of org.apache.servicecomb.foundation.common.concurrency.SuppressedRunnableWrapper in project java-chassis by ServiceComb.

the class RemoteServiceRegistry method run.

@Override
public void run() {
    super.run();
    taskPool.scheduleAtFixedRate(serviceCenterTask, serviceRegistryConfig.getHeartbeatInterval(), serviceRegistryConfig.getHeartbeatInterval(), TimeUnit.SECONDS);
    taskPool.scheduleAtFixedRate(new SuppressedRunnableWrapper(() -> {
        if (!heartBeatStatus.get()) {
            LOGGER.warn("heart beat currently not success, pause for pulling instance.");
            return;
        }
        serviceRegistryCache.refreshCache();
    }), serviceRegistryConfig.getInstancePullInterval(), serviceRegistryConfig.getInstancePullInterval(), TimeUnit.SECONDS);
    for (ServiceRegistryTaskInitializer initializer : taskInitializers) {
        initializer.init(this);
    }
}
Also used : SuppressedRunnableWrapper(org.apache.servicecomb.foundation.common.concurrency.SuppressedRunnableWrapper)

Example 2 with SuppressedRunnableWrapper

use of org.apache.servicecomb.foundation.common.concurrency.SuppressedRunnableWrapper in project java-chassis by ServiceComb.

the class ServiceCenterRegistration method updateMicroserviceInstanceStatus.

@Override
public boolean updateMicroserviceInstanceStatus(MicroserviceInstanceStatus status) {
    RegistryUtils.executeOnEachServiceRegistry(sr -> new SuppressedRunnableWrapper(() -> {
        MicroserviceInstance selfInstance = sr.getMicroserviceInstance();
        sr.getServiceRegistryClient().updateMicroserviceInstanceStatus(selfInstance.getServiceId(), selfInstance.getInstanceId(), status);
    }).run());
    return true;
}
Also used : SuppressedRunnableWrapper(org.apache.servicecomb.foundation.common.concurrency.SuppressedRunnableWrapper) MicroserviceInstance(org.apache.servicecomb.registry.api.registry.MicroserviceInstance)

Example 3 with SuppressedRunnableWrapper

use of org.apache.servicecomb.foundation.common.concurrency.SuppressedRunnableWrapper in project incubator-servicecomb-java-chassis by apache.

the class RemoteServiceRegistry method run.

@Override
public void run() {
    super.run();
    taskPool.scheduleAtFixedRate(serviceCenterTask, serviceRegistryConfig.getHeartbeatInterval(), serviceRegistryConfig.getHeartbeatInterval(), TimeUnit.SECONDS);
    taskPool.scheduleAtFixedRate(new SuppressedRunnableWrapper(() -> {
        if (!heartBeatStatus.get()) {
            LOGGER.warn("heart beat currently not success, pause for pulling instance.");
            return;
        }
        serviceRegistryCache.refreshCache();
    }), serviceRegistryConfig.getInstancePullInterval(), serviceRegistryConfig.getInstancePullInterval(), TimeUnit.SECONDS);
    for (ServiceRegistryTaskInitializer initializer : taskInitializers) {
        initializer.init(this);
    }
}
Also used : SuppressedRunnableWrapper(org.apache.servicecomb.foundation.common.concurrency.SuppressedRunnableWrapper)

Example 4 with SuppressedRunnableWrapper

use of org.apache.servicecomb.foundation.common.concurrency.SuppressedRunnableWrapper in project incubator-servicecomb-java-chassis by apache.

the class ServiceCenterRegistration method updateMicroserviceInstanceStatus.

@Override
public boolean updateMicroserviceInstanceStatus(MicroserviceInstanceStatus status) {
    RegistryUtils.executeOnEachServiceRegistry(sr -> new SuppressedRunnableWrapper(() -> {
        MicroserviceInstance selfInstance = sr.getMicroserviceInstance();
        sr.getServiceRegistryClient().updateMicroserviceInstanceStatus(selfInstance.getServiceId(), selfInstance.getInstanceId(), status);
    }).run());
    return true;
}
Also used : SuppressedRunnableWrapper(org.apache.servicecomb.foundation.common.concurrency.SuppressedRunnableWrapper) MicroserviceInstance(org.apache.servicecomb.registry.api.registry.MicroserviceInstance)

Aggregations

SuppressedRunnableWrapper (org.apache.servicecomb.foundation.common.concurrency.SuppressedRunnableWrapper)4 MicroserviceInstance (org.apache.servicecomb.registry.api.registry.MicroserviceInstance)2