laynotes opened a new issue, #17791:
URL: https://github.com/apache/shardingsphere/issues/17791

   // when i use mgr in  memory mode ,it,conn`t work initHeartBeatJobs !
   private void initHeartBeatJobs(final String databaseName, final Map<String, 
DataSource> dataSourceMap) {
          //when I use Mgr  modeScheduleContext.isPresent() is false
           Optional<ModeScheduleContext> modeScheduleContext = 
ModeScheduleContextFactory.getInstance().get();
           if (modeScheduleContext.isPresent()) {
               for (Entry<String, DatabaseDiscoveryDataSourceRule> entry : 
dataSourceRules.entrySet()) {
                   DatabaseDiscoveryDataSourceRule rule = entry.getValue();
                   Map<String, DataSource> dataSources = 
dataSourceMap.entrySet().stream().filter(each -> 
!rule.getDisabledDataSourceNames().contains(each.getKey()))
                           .collect(Collectors.toMap(Entry::getKey, 
Entry::getValue));
                   String jobName = 
rule.getDatabaseDiscoveryProviderAlgorithm().getType() + "-" + databaseName + 
"-" + rule.getGroupName();
                   CronJob job = new CronJob(jobName, each -> new 
HeartbeatJob(databaseName, rule.getGroupName(), 
rule.getPrimaryDataSourceName(), dataSources,
                           rule.getDatabaseDiscoveryProviderAlgorithm(), 
rule.getDisabledDataSourceNames()).execute(null), 
rule.getHeartbeatProps().getProperty("keep-alive-cron"));
                   modeScheduleContext.get().startCronJob(job);
               }
           }
       }
   
   
   
   


-- 
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-unsubscr...@shardingsphere.apache.org.apache.org

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

Reply via email to