takeseem opened a new issue #1902:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1902


   ## Feature Request
   
   **For English only**, other languages will not accept.
   
   I have a case: 
   
   1. I will start a Timer from a job
   2. when re-sharding, i need found all the shardingItems in this JVM, if the 
item is not in this jvm, I will to stop the timer.
   
   ```
   public final class ShardingContexts implements Serializable {
       public ShardingContext createShardingContext(final int shardingItem) {
           return new ShardingContext(jobName, taskId, shardingTotalCount, 
jobParameter, shardingItem, shardingItemParameters.get(shardingItem), this);
       }
   }
   ```
   I will stop Timer not sharding in this jvm with 
ShardingContext.getShardingContexts().shardingItemParameters(), like this
   ```
       @Override
       public synchronized void execute(ShardingContext shardingContext) {
           tasks.refresh();
           ShardingContexts contexts = shardingContext.getShardingContexts();
           Set<Integer> items = contexts.getShardingItemParameters().keySet();
           for (TimerTask task : tasks.values()) {
               int myitem = task.getId() % 
shardingContext.getShardingTotalCount();
               if (myitem == shardingContext.getShardingItem()) {
                   setTimer(task);
               } else if (!items.contains(myitem)) {
                   cancelTimer(task);
               }
           }
       }
   ```
   ### Is your feature request related to a problem?
   
   ### Describe the feature you would like.
   


-- 
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.

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


Reply via email to