本文整理汇总了Java中com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter类的典型用法代码示例。如果您正苦于以下问题:Java CoordinatorRegistryCenter类的具体用法?Java CoordinatorRegistryCenter怎么用?Java CoordinatorRegistryCenter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CoordinatorRegistryCenter类属于com.dangdang.ddframe.reg.base包,在下文中一共展示了CoordinatorRegistryCenter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstance
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
/**
* 获取全局配置实例
*
* @param coordinatorRegistryCenter 注册中心
* @return 全局配置实例
*/
public static GlobalConfigurationService getInstance(final CoordinatorRegistryCenter coordinatorRegistryCenter) {
if (null == coordinatorRegistryCenter) return null;
if (globalConfigClassPool.containsKey(coordinatorRegistryCenter)) {
return globalConfigClassPool.get(coordinatorRegistryCenter);
}
synchronized(GlobalConfigurationService.class){
if (globalConfigClassPool.containsKey(coordinatorRegistryCenter)) {
return globalConfigClassPool.get(coordinatorRegistryCenter);
} else {
return new GlobalConfigurationService(coordinatorRegistryCenter);
}
}
}
示例2: getTriggerBeginInfo
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
private JobTriggerHistory getTriggerBeginInfo(final CoordinatorRegistryCenter registryCenter, String path) {
path = path.substring(0, path.lastIndexOf("/"));
JobTriggerHistory result = new JobTriggerHistory();
setCommonItem(registryCenter, result, path);
result.setShardingCount(Integer.parseInt(registryCenter.get(getFullPath("/", result.getJobName(), "/config", "/shardingTotalCount"))));
result.setServerIp(registryCenter.get(getFullPath(path, "/serverIp")));
String lastBeginTime = registryCenter.get(getFullPath(path, "/lastBeginTime"));
result.setBeginTime(null == lastBeginTime ? null : new Timestamp(Long.parseLong(lastBeginTime)));
String nextFireTime = registryCenter.get(getFullPath(path, "/nextFireTime"));
result.setNextFireTime(null == nextFireTime ? null : new Timestamp(Long.parseLong(nextFireTime)));
result.setStatus(ExecutionInfo.ExecutionStatus.RUNNING.getCode());
// if (registryCenter.isExisted(getFullPath(path, "/completed"))) {
// result.setStatus(getCompleteFlag(registryCenter, path).getCode());
// String lastCompleteTime = registryCenter.get(getFullPath(path, "/lastCompleteTime"));
// result.setCompleteTime(null == lastCompleteTime ? null : new Timestamp(Long.parseLong(lastCompleteTime)));
// }
return result;
}
示例3: getCompleteFlag
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
private ExecutionInfo.ExecutionStatus getCompleteFlag(final CoordinatorRegistryCenter registryCenter, final String path) {
boolean completeFlag;
String completedPath = getFullPath(path, "/completed");
String completedValue = registryCenter.get(completedPath);
if (Strings.isNullOrEmpty(completedValue)) {
// 兼容老版本"/completed"无值的情况
completeFlag = true;
} else {
completeFlag = Boolean.valueOf(completedValue);
}
if (completeFlag) {
return ExecutionInfo.ExecutionStatus.COMPLETED;
} else {
return ExecutionInfo.ExecutionStatus.FAILED;
}
}
示例4: createCoordinatorRegistryCenter
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
/**
* 创建注册中心.
*
* @param connectString 注册中心连接字符串
* @param namespace 注册中心命名空间
* @param digest 注册中心凭证
* @return 注册中心对象
*/
public static CoordinatorRegistryCenter createCoordinatorRegistryCenter(final String connectString, final String namespace, final Optional<String> digest) {
Hasher hasher = Hashing.md5().newHasher().putString(connectString, Charsets.UTF_8).putString(namespace, Charsets.UTF_8);
if (digest.isPresent()) {
hasher.putString(digest.get(), Charsets.UTF_8);
}
HashCode hashCode = hasher.hash();
if (registryCenterMap.containsKey(hashCode)) {
return registryCenterMap.get(hashCode);
}
ZookeeperConfiguration zkConfig = new ZookeeperConfiguration(connectString, namespace);
if (digest.isPresent()) {
zkConfig.setDigest(digest.get());
}
CoordinatorRegistryCenter result = new ZookeeperRegistryCenter(zkConfig);
result.init();
registryCenterMap.putIfAbsent(hashCode, result);
return result;
}
示例5: JobScheduler
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
public JobScheduler(final CoordinatorRegistryCenter regCenter, final JobConfiguration jobConfig, final ElasticJobListener... elasticJobListeners) {
jobName = jobConfig.getJobName();
this.regCenter = regCenter;
List<ElasticJobListener> elasticJobListenerList = Arrays.asList(elasticJobListeners);
setGuaranteeServiceForElasticJobListeners(regCenter, jobConfig, elasticJobListenerList);
schedulerFacade = new SchedulerFacade(regCenter, jobConfig, elasticJobListenerList);
jobFacade = new JobFacade(regCenter, jobConfig, elasticJobListenerList);
jobDetail = JobBuilder.newJob(jobConfig.getJobClass()).withIdentity(jobName).build();
}
示例6: setGuaranteeServiceForElasticJobListeners
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
private void setGuaranteeServiceForElasticJobListeners(final CoordinatorRegistryCenter regCenter, final JobConfiguration jobConfig, final List<ElasticJobListener> elasticJobListeners) {
GuaranteeService guaranteeService = new GuaranteeService(regCenter, jobConfig);
for (ElasticJobListener each : elasticJobListeners) {
if (each instanceof AbstractDistributeOnceElasticJobListener) {
((AbstractDistributeOnceElasticJobListener) each).setGuaranteeService(guaranteeService);
}
}
}
示例7: ListenerManager
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
public ListenerManager(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration, final List<ElasticJobListener> elasticJobListeners) {
electionListenerManager = new ElectionListenerManager(coordinatorRegistryCenter, jobConfiguration);
shardingListenerManager = new ShardingListenerManager(coordinatorRegistryCenter, jobConfiguration);
executionListenerManager = new ExecutionListenerManager(coordinatorRegistryCenter, jobConfiguration);
failoverListenerManager = new FailoverListenerManager(coordinatorRegistryCenter, jobConfiguration);
jobOperationListenerManager = new JobOperationListenerManager(coordinatorRegistryCenter, jobConfiguration);
configurationListenerManager = new ConfigurationListenerManager(coordinatorRegistryCenter, jobConfiguration);
guaranteeListenerManager = new GuaranteeListenerManager(coordinatorRegistryCenter, jobConfiguration, elasticJobListeners);
globalConfigListenerManager = new GlobalConfigListenerManager(coordinatorRegistryCenter);
}
示例8: JobFacade
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
public JobFacade(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration, final List<ElasticJobListener> elasticJobListeners) {
configService = new ConfigurationService(coordinatorRegistryCenter, jobConfiguration);
globalConfigService = GlobalConfigurationService.getInstance(coordinatorRegistryCenter);
shardingService = new ShardingService(coordinatorRegistryCenter, jobConfiguration);
serverService = new ServerService(coordinatorRegistryCenter, jobConfiguration);
executionContextService = new ExecutionContextService(coordinatorRegistryCenter, jobConfiguration);
executionService = new ExecutionService(coordinatorRegistryCenter, jobConfiguration);
failoverService = new FailoverService(coordinatorRegistryCenter, jobConfiguration);
offsetService = new OffsetService(coordinatorRegistryCenter, jobConfiguration);
this.elasticJobListeners = elasticJobListeners;
}
示例9: SchedulerFacade
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
public SchedulerFacade(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration, final List<ElasticJobListener> elasticJobListeners) {
configService = new ConfigurationService(coordinatorRegistryCenter, jobConfiguration);
leaderElectionService = new LeaderElectionService(coordinatorRegistryCenter, jobConfiguration);
serverService = new ServerService(coordinatorRegistryCenter, jobConfiguration);
shardingService = new ShardingService(coordinatorRegistryCenter, jobConfiguration);
executionService = new ExecutionService(coordinatorRegistryCenter, jobConfiguration);
statisticsService = new StatisticsService(coordinatorRegistryCenter, jobConfiguration);
monitorService = new MonitorService(coordinatorRegistryCenter, jobConfiguration);
listenerManager = new ListenerManager(coordinatorRegistryCenter, jobConfiguration, elasticJobListeners);
}
示例10: ElectionListenerManager
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
public ElectionListenerManager(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration) {
super(coordinatorRegistryCenter, jobConfiguration);
leaderElectionService = new LeaderElectionService(coordinatorRegistryCenter, jobConfiguration);
serverService = new ServerService(coordinatorRegistryCenter, jobConfiguration);
electionNode = new ElectionNode(jobConfiguration.getJobName());
serverNode = new ServerNode(jobConfiguration.getJobName());
}
示例11: ExecutionService
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
public ExecutionService(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration) {
this.jobConfiguration = jobConfiguration;
jobNodeStorage = new JobNodeStorage(coordinatorRegistryCenter, jobConfiguration);
configService = new ConfigurationService(coordinatorRegistryCenter, jobConfiguration);
serverService = new ServerService(coordinatorRegistryCenter, jobConfiguration);
leaderElectionService = new LeaderElectionService(coordinatorRegistryCenter, jobConfiguration);
}
示例12: JobOperationListenerManager
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
public JobOperationListenerManager(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration) {
super(coordinatorRegistryCenter, jobConfiguration);
jobName = jobConfiguration.getJobName();
serverNode = new ServerNode(jobName);
leaderElectionService = new LeaderElectionService(coordinatorRegistryCenter, jobConfiguration);
serverService = new ServerService(coordinatorRegistryCenter, jobConfiguration);
shardingService = new ShardingService(coordinatorRegistryCenter, jobConfiguration);
executionService = new ExecutionService(coordinatorRegistryCenter, jobConfiguration);
}
示例13: FailoverListenerManager
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
public FailoverListenerManager(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration) {
super(coordinatorRegistryCenter, jobConfiguration);
configService = new ConfigurationService(coordinatorRegistryCenter, jobConfiguration);
executionService = new ExecutionService(coordinatorRegistryCenter, jobConfiguration);
shardingService = new ShardingService(coordinatorRegistryCenter, jobConfiguration);
failoverService = new FailoverService(coordinatorRegistryCenter, jobConfiguration);
configNode = new ConfigurationNode(jobConfiguration.getJobName());
executionNode = new ExecutionNode(jobConfiguration.getJobName());
failoverNode = new FailoverNode(jobConfiguration.getJobName());
}
示例14: ShardingListenerManager
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
public ShardingListenerManager(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration) {
super(coordinatorRegistryCenter, jobConfiguration);
shardingService = new ShardingService(coordinatorRegistryCenter, jobConfiguration);
executionService = new ExecutionService(coordinatorRegistryCenter, jobConfiguration);
configurationNode = new ConfigurationNode(jobConfiguration.getJobName());
serverNode = new ServerNode(jobConfiguration.getJobName());
}
示例15: ShardingService
import com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter; //导入依赖的package包/类
public ShardingService(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration) {
jobName = jobConfiguration.getJobName();
jobNodeStorage = new JobNodeStorage(coordinatorRegistryCenter, jobConfiguration);
leaderElectionService = new LeaderElectionService(coordinatorRegistryCenter, jobConfiguration);
configService = new ConfigurationService(coordinatorRegistryCenter, jobConfiguration);
serverService = new ServerService(coordinatorRegistryCenter, jobConfiguration);
executionService = new ExecutionService(coordinatorRegistryCenter, jobConfiguration);
globalConfigService = GlobalConfigurationService.getInstance(coordinatorRegistryCenter);
jobNodePath = new JobNodePath(jobConfiguration.getJobName());
}