Search in sources :

Example 6 with JobNodeStorage

use of com.vip.saturn.job.internal.storage.JobNodeStorage in project Saturn by vipshop.

the class SaturnAutoBasic method updateJobConfig.

protected static void updateJobConfig(JobConfiguration jobConfiguration, String configKey, Object configValue) {
    JobNodeStorage jobNodeStorage = new JobNodeStorage(regCenter, jobConfiguration);
    jobNodeStorage.updateJobNode("config/" + configKey, configValue);
}
Also used : JobNodeStorage(com.vip.saturn.job.internal.storage.JobNodeStorage)

Example 7 with JobNodeStorage

use of com.vip.saturn.job.internal.storage.JobNodeStorage in project Saturn by vipshop.

the class LeaderElectionService method shutdown.

@Override
public void shutdown() {
    synchronized (isShutdown) {
        if (isShutdown.compareAndSet(false, true)) {
            try {
                // Release my leader position
                JobNodeStorage jobNodeStorage = getJobNodeStorage();
                if (jobNodeStorage.isConnected() && executorName.equals(jobNodeStorage.getJobNodeDataDirectly(ElectionNode.LEADER_HOST))) {
                    jobNodeStorage.removeJobNodeIfExisted(ElectionNode.LEADER_HOST);
                    LogUtils.info(log, jobName, "{} that was {}'s leader, released itself", executorName, jobName);
                }
            } catch (Throwable t) {
                LogUtils.error(log, jobName, t.getMessage(), t);
            }
        }
    }
}
Also used : JobNodeStorage(com.vip.saturn.job.internal.storage.JobNodeStorage)

Aggregations

JobNodeStorage (com.vip.saturn.job.internal.storage.JobNodeStorage)7 JobConfiguration (com.vip.saturn.job.internal.config.JobConfiguration)1