You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/11/17 06:55:13 UTC

[GitHub] [shardingsphere-elasticjob] xiebin2015 commented on issue #2002: Elasitcjob3 execution problem

xiebin2015 commented on issue #2002:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/2002#issuecomment-971261582


   Hi @TeslaCN 
    @Bean(initMethod = "init")
       public CoordinatorRegistryCenter zookeeperRegistryCenter() {
           ZookeeperConfiguration zkConfig = new ZookeeperConfiguration(zookeeperProperties.getServerLists(), zookeeperProperties.getNamespace());
           zkConfig.setBaseSleepTimeMilliseconds(zookeeperProperties.getBaseSleepTimeMilliseconds());
           zkConfig.setConnectionTimeoutMilliseconds(zookeeperProperties.getConnectionTimeoutMilliseconds());
           zkConfig.setDigest(zookeeperProperties.getDigest());
           zkConfig.setMaxRetries(zookeeperProperties.getMaxRetries());
           zkConfig.setMaxSleepTimeMilliseconds(zookeeperProperties.getMaxSleepTimeMilliseconds());
           zkConfig.setSessionTimeoutMilliseconds(zookeeperProperties.getSessionTimeoutMilliseconds());
           CoordinatorRegistryCenter coordinatorRegistryCenter = new ZookeeperRegistryCenter(zkConfig);
           coordinatorRegistryCenter.init();
           return coordinatorRegistryCenter;
       }
   @Override
       public ScheduleJobBootstrap prepareScheduleJobBootstrap(Job job, Object jobBean) throws PendingException {
           try {
               //作业对象
               ElasticJob elasticjob = (ElasticJob) jobBean;
               return new ScheduleJobBootstrap(getCoordinatorRegistryCenter(), elasticjob, jobCoreConfiguration(job));
           } catch (Exception e) {
               log.error("【" + job.getJobName() + "】\t初始化失败", e);
               throw new PendingException(SysCode.SYS_FAIL, "\"【\" + job.getJobName() + \"】\\t初始化失败", e);
           }
       }
   
       


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org