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);
               }
           }
       }
   
   
   Fixes https://github.com/apache/shardingsphere/issues/13875 part 7.
   
   Changes proposed in this pull request:
   
   Add ModeScheduleContext and integrate with ContextManager. Design for MGR 
scheduling requirement for now.
   Currently, not all mode type is supported:
   
   Supported : "Cluster" mode type, "ZooKeeper" repository type
   Unsupported : "Standalone" mode type, "Memory" mode type and other 
repository type in "Cluster" mode
   Sharing registry center API of ShardingSphere and ElasticJob is considerred, 
API:
   
   ShardingSphere : PersistRepository, ClusterPersistRepository, 
StandalonePersistRepository
   ElasticJob : CoordinatorRegistryCenter
   They are so different to use adapter design pattern.
   


-- 
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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to