Spring TaskScheduling with HashMap












0












$begingroup$


I am currently developing a Task Scheduler to run different methods at a certain time. In general it is a Spring-boot application an task execution/scheduling is just a very tiny piece of the whole project. My idea is to define several Runnables that execute depending on a CronTrigger. In the Runnable I create an object Job that holds information about the current task, like startTime, status and others.



public class Job {
private Long id;
private Class clazz;
private Date startTime;
private boolean status;
private String parameter;
private CronTrigger cronTrigger;
private String exception;

Job(long id, Class<?> clazz, boolean status, Date startTime, String parameter, CronTrigger cronTrigger, String exception) {
this.id = id;
this.clazz = clazz;
this.startTime = startTime;
this.status = status;
this.parameter = parameter;
this.cronTrigger = cronTrigger;
this.exception = exception;
}

//Getter, Setter, toString()
}


To represent which thread is currently running/waiting I add it to ConcurrentHashMap<Long, Job> there are two, one for sleeping Thread and one for running Threads.
There are also two methods addTask(Long task, Job job) and removeTask(Long task, Job job) that put/remove Jobs to/from the two ConcurrentHashMaps and set status of an Job.



private ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();

private HashMap<Long, CronTrigger> cronTriggers = new HashMap<>();

private ScheduledFuture<?> task0;
private ScheduledFuture<?> task1;
private ScheduledFuture<?> task2;
private ScheduledFuture<?> task3;
private ScheduledFuture<?> task4;
private ScheduledFuture<?> task5;
private ScheduledFuture<?> task6;
private ScheduledFuture<?> task7;
private ScheduledFuture<?> task8;
private ScheduledFuture<?> task9;

private final ConcurrentHashMap<Long, Job> scheduledTasksRunning = new ConcurrentHashMap<>();
private final ConcurrentHashMap<Long, Job> scheduledTasksSleeping = new ConcurrentHashMap<>();

private Job selectedScheduledJob;

private int POOL_SIZE = 10;

@Bean
public ThreadPoolTaskScheduler taskScheduler() {

this.scheduler.setPoolSize(POOL_SIZE);
this.scheduler.initialize();

for (int i = 0; i < POOL_SIZE; i++){
cronTriggers.put(((long) i), new CronTrigger("1 1 1 1 * *"));
}

for (int i = 0; i < POOL_SIZE; i++){
Job job = new Job((long) i, getClass(), false, new Date(),null, cronTriggers.get((long) i), null);
scheduledTasksSleeping.put(((long) i), job);
}

task0 = scheduler.schedule(new Task0(), cronTriggers.get(0L));
task1 = scheduler.schedule(new Task1(), cronTriggers.get(1L));
task2 = scheduler.schedule(new Task2(), cronTriggers.get(2L));
task3 = scheduler.schedule(new Task3(), cronTriggers.get(3L));
task4 = scheduler.schedule(new Task4(), cronTriggers.get(4L));
task5 = scheduler.schedule(new Task5(), cronTriggers.get(5L));
task6 = scheduler.schedule(new Task6(), cronTriggers.get(6L));
task7 = scheduler.schedule(new Task7(), cronTriggers.get(7L));
task8 = scheduler.schedule(new Task8(), cronTriggers.get(8L));
task9 = scheduler.schedule(new Task9(), cronTriggers.get(9L));
return scheduler;
}

public class Task0 implements Runnable {
public void run() {
Long id = 0L;
Job job = new Job(id, getClass(), true, new Date(), null, cronTriggers.get(id), null);
addTask(id, job);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
job.setException(e.toString());
e.printStackTrace();
}
removeTask(id, job);
}
}

public class Task1 implements Runnable {
public void run() {
Long id = 1L;
Job job = new Job(id, getClass(), true, new Date(), null, cronTriggers.get(id), null);
addTask(id, job);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
job.setException(e.toString());
e.printStackTrace();
}
removeTask(id, job);
}
}

// 8 other Runnables


/**
* manually stop a running Job via GUI
*
*/
public void taskCancel(){
Long id = selectedScheduledJob.getId();
switch (toIntExact(id)){
case 0:
task0.cancel(true);
break;
case 1:
task1.cancel(true);
break;
// 8 other cases for each Thread
}
}

/**
* manually start a selected Job via GUI and force it to trigger at next
* scheduled time
*/
public void taskStart(){
Long id = selectedScheduledJob.getId();
switch (toIntExact(id)){

case 0:
scheduler.schedule(new Task0(), new Date());
scheduler.schedule(new Task0(), cronTriggers.get(id));
break;
case 1:
scheduler.schedule(new Task1(), new Date());
scheduler.schedule(new Task1(), cronTriggers.get(id));
break;
// 8 other cases for each Thread
}
}

private synchronized void addTask(Long task, Job job) {
scheduledTasksSleeping.remove(task);
scheduledTasksRunning.put(task, job);
}

private synchronized void removeTask(Long task, Job job) {
job.setStatus(false);
scheduledTasksRunning.remove(task);
scheduledTasksSleeping.put(task, job);
}

// Getter and Setter for GUI


I know however that the definition of ScheduledFuture<?> taskX; is not that good and I tend to use a ArrayList in future.



Some things I am interested in:




  • Is there anything I did that is blatantly the wrong way of doing it?

  • Do you see any way to improve the performance or speed?

  • Is it thread-safe?









share







New contributor




WirJun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$

















    0












    $begingroup$


    I am currently developing a Task Scheduler to run different methods at a certain time. In general it is a Spring-boot application an task execution/scheduling is just a very tiny piece of the whole project. My idea is to define several Runnables that execute depending on a CronTrigger. In the Runnable I create an object Job that holds information about the current task, like startTime, status and others.



    public class Job {
    private Long id;
    private Class clazz;
    private Date startTime;
    private boolean status;
    private String parameter;
    private CronTrigger cronTrigger;
    private String exception;

    Job(long id, Class<?> clazz, boolean status, Date startTime, String parameter, CronTrigger cronTrigger, String exception) {
    this.id = id;
    this.clazz = clazz;
    this.startTime = startTime;
    this.status = status;
    this.parameter = parameter;
    this.cronTrigger = cronTrigger;
    this.exception = exception;
    }

    //Getter, Setter, toString()
    }


    To represent which thread is currently running/waiting I add it to ConcurrentHashMap<Long, Job> there are two, one for sleeping Thread and one for running Threads.
    There are also two methods addTask(Long task, Job job) and removeTask(Long task, Job job) that put/remove Jobs to/from the two ConcurrentHashMaps and set status of an Job.



    private ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();

    private HashMap<Long, CronTrigger> cronTriggers = new HashMap<>();

    private ScheduledFuture<?> task0;
    private ScheduledFuture<?> task1;
    private ScheduledFuture<?> task2;
    private ScheduledFuture<?> task3;
    private ScheduledFuture<?> task4;
    private ScheduledFuture<?> task5;
    private ScheduledFuture<?> task6;
    private ScheduledFuture<?> task7;
    private ScheduledFuture<?> task8;
    private ScheduledFuture<?> task9;

    private final ConcurrentHashMap<Long, Job> scheduledTasksRunning = new ConcurrentHashMap<>();
    private final ConcurrentHashMap<Long, Job> scheduledTasksSleeping = new ConcurrentHashMap<>();

    private Job selectedScheduledJob;

    private int POOL_SIZE = 10;

    @Bean
    public ThreadPoolTaskScheduler taskScheduler() {

    this.scheduler.setPoolSize(POOL_SIZE);
    this.scheduler.initialize();

    for (int i = 0; i < POOL_SIZE; i++){
    cronTriggers.put(((long) i), new CronTrigger("1 1 1 1 * *"));
    }

    for (int i = 0; i < POOL_SIZE; i++){
    Job job = new Job((long) i, getClass(), false, new Date(),null, cronTriggers.get((long) i), null);
    scheduledTasksSleeping.put(((long) i), job);
    }

    task0 = scheduler.schedule(new Task0(), cronTriggers.get(0L));
    task1 = scheduler.schedule(new Task1(), cronTriggers.get(1L));
    task2 = scheduler.schedule(new Task2(), cronTriggers.get(2L));
    task3 = scheduler.schedule(new Task3(), cronTriggers.get(3L));
    task4 = scheduler.schedule(new Task4(), cronTriggers.get(4L));
    task5 = scheduler.schedule(new Task5(), cronTriggers.get(5L));
    task6 = scheduler.schedule(new Task6(), cronTriggers.get(6L));
    task7 = scheduler.schedule(new Task7(), cronTriggers.get(7L));
    task8 = scheduler.schedule(new Task8(), cronTriggers.get(8L));
    task9 = scheduler.schedule(new Task9(), cronTriggers.get(9L));
    return scheduler;
    }

    public class Task0 implements Runnable {
    public void run() {
    Long id = 0L;
    Job job = new Job(id, getClass(), true, new Date(), null, cronTriggers.get(id), null);
    addTask(id, job);
    try {
    Thread.sleep(10000);
    } catch (InterruptedException e) {
    job.setException(e.toString());
    e.printStackTrace();
    }
    removeTask(id, job);
    }
    }

    public class Task1 implements Runnable {
    public void run() {
    Long id = 1L;
    Job job = new Job(id, getClass(), true, new Date(), null, cronTriggers.get(id), null);
    addTask(id, job);
    try {
    Thread.sleep(10000);
    } catch (InterruptedException e) {
    job.setException(e.toString());
    e.printStackTrace();
    }
    removeTask(id, job);
    }
    }

    // 8 other Runnables


    /**
    * manually stop a running Job via GUI
    *
    */
    public void taskCancel(){
    Long id = selectedScheduledJob.getId();
    switch (toIntExact(id)){
    case 0:
    task0.cancel(true);
    break;
    case 1:
    task1.cancel(true);
    break;
    // 8 other cases for each Thread
    }
    }

    /**
    * manually start a selected Job via GUI and force it to trigger at next
    * scheduled time
    */
    public void taskStart(){
    Long id = selectedScheduledJob.getId();
    switch (toIntExact(id)){

    case 0:
    scheduler.schedule(new Task0(), new Date());
    scheduler.schedule(new Task0(), cronTriggers.get(id));
    break;
    case 1:
    scheduler.schedule(new Task1(), new Date());
    scheduler.schedule(new Task1(), cronTriggers.get(id));
    break;
    // 8 other cases for each Thread
    }
    }

    private synchronized void addTask(Long task, Job job) {
    scheduledTasksSleeping.remove(task);
    scheduledTasksRunning.put(task, job);
    }

    private synchronized void removeTask(Long task, Job job) {
    job.setStatus(false);
    scheduledTasksRunning.remove(task);
    scheduledTasksSleeping.put(task, job);
    }

    // Getter and Setter for GUI


    I know however that the definition of ScheduledFuture<?> taskX; is not that good and I tend to use a ArrayList in future.



    Some things I am interested in:




    • Is there anything I did that is blatantly the wrong way of doing it?

    • Do you see any way to improve the performance or speed?

    • Is it thread-safe?









    share







    New contributor




    WirJun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.







    $endgroup$















      0












      0








      0





      $begingroup$


      I am currently developing a Task Scheduler to run different methods at a certain time. In general it is a Spring-boot application an task execution/scheduling is just a very tiny piece of the whole project. My idea is to define several Runnables that execute depending on a CronTrigger. In the Runnable I create an object Job that holds information about the current task, like startTime, status and others.



      public class Job {
      private Long id;
      private Class clazz;
      private Date startTime;
      private boolean status;
      private String parameter;
      private CronTrigger cronTrigger;
      private String exception;

      Job(long id, Class<?> clazz, boolean status, Date startTime, String parameter, CronTrigger cronTrigger, String exception) {
      this.id = id;
      this.clazz = clazz;
      this.startTime = startTime;
      this.status = status;
      this.parameter = parameter;
      this.cronTrigger = cronTrigger;
      this.exception = exception;
      }

      //Getter, Setter, toString()
      }


      To represent which thread is currently running/waiting I add it to ConcurrentHashMap<Long, Job> there are two, one for sleeping Thread and one for running Threads.
      There are also two methods addTask(Long task, Job job) and removeTask(Long task, Job job) that put/remove Jobs to/from the two ConcurrentHashMaps and set status of an Job.



      private ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();

      private HashMap<Long, CronTrigger> cronTriggers = new HashMap<>();

      private ScheduledFuture<?> task0;
      private ScheduledFuture<?> task1;
      private ScheduledFuture<?> task2;
      private ScheduledFuture<?> task3;
      private ScheduledFuture<?> task4;
      private ScheduledFuture<?> task5;
      private ScheduledFuture<?> task6;
      private ScheduledFuture<?> task7;
      private ScheduledFuture<?> task8;
      private ScheduledFuture<?> task9;

      private final ConcurrentHashMap<Long, Job> scheduledTasksRunning = new ConcurrentHashMap<>();
      private final ConcurrentHashMap<Long, Job> scheduledTasksSleeping = new ConcurrentHashMap<>();

      private Job selectedScheduledJob;

      private int POOL_SIZE = 10;

      @Bean
      public ThreadPoolTaskScheduler taskScheduler() {

      this.scheduler.setPoolSize(POOL_SIZE);
      this.scheduler.initialize();

      for (int i = 0; i < POOL_SIZE; i++){
      cronTriggers.put(((long) i), new CronTrigger("1 1 1 1 * *"));
      }

      for (int i = 0; i < POOL_SIZE; i++){
      Job job = new Job((long) i, getClass(), false, new Date(),null, cronTriggers.get((long) i), null);
      scheduledTasksSleeping.put(((long) i), job);
      }

      task0 = scheduler.schedule(new Task0(), cronTriggers.get(0L));
      task1 = scheduler.schedule(new Task1(), cronTriggers.get(1L));
      task2 = scheduler.schedule(new Task2(), cronTriggers.get(2L));
      task3 = scheduler.schedule(new Task3(), cronTriggers.get(3L));
      task4 = scheduler.schedule(new Task4(), cronTriggers.get(4L));
      task5 = scheduler.schedule(new Task5(), cronTriggers.get(5L));
      task6 = scheduler.schedule(new Task6(), cronTriggers.get(6L));
      task7 = scheduler.schedule(new Task7(), cronTriggers.get(7L));
      task8 = scheduler.schedule(new Task8(), cronTriggers.get(8L));
      task9 = scheduler.schedule(new Task9(), cronTriggers.get(9L));
      return scheduler;
      }

      public class Task0 implements Runnable {
      public void run() {
      Long id = 0L;
      Job job = new Job(id, getClass(), true, new Date(), null, cronTriggers.get(id), null);
      addTask(id, job);
      try {
      Thread.sleep(10000);
      } catch (InterruptedException e) {
      job.setException(e.toString());
      e.printStackTrace();
      }
      removeTask(id, job);
      }
      }

      public class Task1 implements Runnable {
      public void run() {
      Long id = 1L;
      Job job = new Job(id, getClass(), true, new Date(), null, cronTriggers.get(id), null);
      addTask(id, job);
      try {
      Thread.sleep(10000);
      } catch (InterruptedException e) {
      job.setException(e.toString());
      e.printStackTrace();
      }
      removeTask(id, job);
      }
      }

      // 8 other Runnables


      /**
      * manually stop a running Job via GUI
      *
      */
      public void taskCancel(){
      Long id = selectedScheduledJob.getId();
      switch (toIntExact(id)){
      case 0:
      task0.cancel(true);
      break;
      case 1:
      task1.cancel(true);
      break;
      // 8 other cases for each Thread
      }
      }

      /**
      * manually start a selected Job via GUI and force it to trigger at next
      * scheduled time
      */
      public void taskStart(){
      Long id = selectedScheduledJob.getId();
      switch (toIntExact(id)){

      case 0:
      scheduler.schedule(new Task0(), new Date());
      scheduler.schedule(new Task0(), cronTriggers.get(id));
      break;
      case 1:
      scheduler.schedule(new Task1(), new Date());
      scheduler.schedule(new Task1(), cronTriggers.get(id));
      break;
      // 8 other cases for each Thread
      }
      }

      private synchronized void addTask(Long task, Job job) {
      scheduledTasksSleeping.remove(task);
      scheduledTasksRunning.put(task, job);
      }

      private synchronized void removeTask(Long task, Job job) {
      job.setStatus(false);
      scheduledTasksRunning.remove(task);
      scheduledTasksSleeping.put(task, job);
      }

      // Getter and Setter for GUI


      I know however that the definition of ScheduledFuture<?> taskX; is not that good and I tend to use a ArrayList in future.



      Some things I am interested in:




      • Is there anything I did that is blatantly the wrong way of doing it?

      • Do you see any way to improve the performance or speed?

      • Is it thread-safe?









      share







      New contributor




      WirJun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.







      $endgroup$




      I am currently developing a Task Scheduler to run different methods at a certain time. In general it is a Spring-boot application an task execution/scheduling is just a very tiny piece of the whole project. My idea is to define several Runnables that execute depending on a CronTrigger. In the Runnable I create an object Job that holds information about the current task, like startTime, status and others.



      public class Job {
      private Long id;
      private Class clazz;
      private Date startTime;
      private boolean status;
      private String parameter;
      private CronTrigger cronTrigger;
      private String exception;

      Job(long id, Class<?> clazz, boolean status, Date startTime, String parameter, CronTrigger cronTrigger, String exception) {
      this.id = id;
      this.clazz = clazz;
      this.startTime = startTime;
      this.status = status;
      this.parameter = parameter;
      this.cronTrigger = cronTrigger;
      this.exception = exception;
      }

      //Getter, Setter, toString()
      }


      To represent which thread is currently running/waiting I add it to ConcurrentHashMap<Long, Job> there are two, one for sleeping Thread and one for running Threads.
      There are also two methods addTask(Long task, Job job) and removeTask(Long task, Job job) that put/remove Jobs to/from the two ConcurrentHashMaps and set status of an Job.



      private ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();

      private HashMap<Long, CronTrigger> cronTriggers = new HashMap<>();

      private ScheduledFuture<?> task0;
      private ScheduledFuture<?> task1;
      private ScheduledFuture<?> task2;
      private ScheduledFuture<?> task3;
      private ScheduledFuture<?> task4;
      private ScheduledFuture<?> task5;
      private ScheduledFuture<?> task6;
      private ScheduledFuture<?> task7;
      private ScheduledFuture<?> task8;
      private ScheduledFuture<?> task9;

      private final ConcurrentHashMap<Long, Job> scheduledTasksRunning = new ConcurrentHashMap<>();
      private final ConcurrentHashMap<Long, Job> scheduledTasksSleeping = new ConcurrentHashMap<>();

      private Job selectedScheduledJob;

      private int POOL_SIZE = 10;

      @Bean
      public ThreadPoolTaskScheduler taskScheduler() {

      this.scheduler.setPoolSize(POOL_SIZE);
      this.scheduler.initialize();

      for (int i = 0; i < POOL_SIZE; i++){
      cronTriggers.put(((long) i), new CronTrigger("1 1 1 1 * *"));
      }

      for (int i = 0; i < POOL_SIZE; i++){
      Job job = new Job((long) i, getClass(), false, new Date(),null, cronTriggers.get((long) i), null);
      scheduledTasksSleeping.put(((long) i), job);
      }

      task0 = scheduler.schedule(new Task0(), cronTriggers.get(0L));
      task1 = scheduler.schedule(new Task1(), cronTriggers.get(1L));
      task2 = scheduler.schedule(new Task2(), cronTriggers.get(2L));
      task3 = scheduler.schedule(new Task3(), cronTriggers.get(3L));
      task4 = scheduler.schedule(new Task4(), cronTriggers.get(4L));
      task5 = scheduler.schedule(new Task5(), cronTriggers.get(5L));
      task6 = scheduler.schedule(new Task6(), cronTriggers.get(6L));
      task7 = scheduler.schedule(new Task7(), cronTriggers.get(7L));
      task8 = scheduler.schedule(new Task8(), cronTriggers.get(8L));
      task9 = scheduler.schedule(new Task9(), cronTriggers.get(9L));
      return scheduler;
      }

      public class Task0 implements Runnable {
      public void run() {
      Long id = 0L;
      Job job = new Job(id, getClass(), true, new Date(), null, cronTriggers.get(id), null);
      addTask(id, job);
      try {
      Thread.sleep(10000);
      } catch (InterruptedException e) {
      job.setException(e.toString());
      e.printStackTrace();
      }
      removeTask(id, job);
      }
      }

      public class Task1 implements Runnable {
      public void run() {
      Long id = 1L;
      Job job = new Job(id, getClass(), true, new Date(), null, cronTriggers.get(id), null);
      addTask(id, job);
      try {
      Thread.sleep(10000);
      } catch (InterruptedException e) {
      job.setException(e.toString());
      e.printStackTrace();
      }
      removeTask(id, job);
      }
      }

      // 8 other Runnables


      /**
      * manually stop a running Job via GUI
      *
      */
      public void taskCancel(){
      Long id = selectedScheduledJob.getId();
      switch (toIntExact(id)){
      case 0:
      task0.cancel(true);
      break;
      case 1:
      task1.cancel(true);
      break;
      // 8 other cases for each Thread
      }
      }

      /**
      * manually start a selected Job via GUI and force it to trigger at next
      * scheduled time
      */
      public void taskStart(){
      Long id = selectedScheduledJob.getId();
      switch (toIntExact(id)){

      case 0:
      scheduler.schedule(new Task0(), new Date());
      scheduler.schedule(new Task0(), cronTriggers.get(id));
      break;
      case 1:
      scheduler.schedule(new Task1(), new Date());
      scheduler.schedule(new Task1(), cronTriggers.get(id));
      break;
      // 8 other cases for each Thread
      }
      }

      private synchronized void addTask(Long task, Job job) {
      scheduledTasksSleeping.remove(task);
      scheduledTasksRunning.put(task, job);
      }

      private synchronized void removeTask(Long task, Job job) {
      job.setStatus(false);
      scheduledTasksRunning.remove(task);
      scheduledTasksSleeping.put(task, job);
      }

      // Getter and Setter for GUI


      I know however that the definition of ScheduledFuture<?> taskX; is not that good and I tend to use a ArrayList in future.



      Some things I am interested in:




      • Is there anything I did that is blatantly the wrong way of doing it?

      • Do you see any way to improve the performance or speed?

      • Is it thread-safe?







      java thread-safety spring





      share







      New contributor




      WirJun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      WirJun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      WirJun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 7 mins ago









      WirJunWirJun

      1




      1




      New contributor




      WirJun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      WirJun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      WirJun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "196"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          WirJun is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f212519%2fspring-taskscheduling-with-hashmap%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          WirJun is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          WirJun is a new contributor. Be nice, and check out our Code of Conduct.













          WirJun is a new contributor. Be nice, and check out our Code of Conduct.












          WirJun is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f212519%2fspring-taskscheduling-with-hashmap%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          TypeError: fit_transform() missing 1 required positional argument: 'X'