Skip to content

wagnerjfr/Java-TaskScheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java-Task-Scheduler


HOW TO CREATE A TASK

  1. Create a new class "Task1" (or the name you want it) which must extend factory.Task class, and put it inside the package "task";
  2. You must override the method "executeTask()" that returns a String;
  3. You can display, in the Scheduler execution, the result from a Task by returning some String;
  4. You can also save some result to an Object type variable "response" in order to use it in some dependent task;

HOW TO CREATE A DEPENDENCY TASK

  1. All the steps from "How to create a Task";
  2. You must certify whether the Task has a response from a Father's Task by using the function "hasFatherTaskResponse()";
  3. There are also ways to check the response type "isFatherResponseType(Class type)" or the way you prefer, before casting the Object to the type you want it;

HOW TO INSERT THE TASK IN THE LIST TO BE EXCECUTED BY THE SCHEDULER

  1. Open config.properties file;

  2. You can either change an existing property "list_of_tasks", or comment (//) and create another one;

  3. The syntax for creating a unique task with no dependency in the list is:

  • name_father_task_class:fixed_rate,given_delay);
Fibonacci46:60,0);
  • The scheduler will run the Fibonacci46 Task every 60 seconds, with a zero second delay for a dependency (there is none in the above example).
  1. The syntax for creating a task with 1 or more parallel dependencies.
  • You must separate the tasks by using the "--" symbol and the ":given_delay" flag in dependencies is not mandatory;
  • name_father_task_class:fixed_rate,given_delay)name_class_task1:given_delay--name_class_task2:given_delay--name_class_taskN:given_delay;
SortingCreateArrays:60,5)SortingBubble--SortingInsertion;
  • As the dependencies run in parallel, it's not necessary to specify a given delay, as shown in the above example.
  1. The syntax for creating a task with 1 or more sequential dependencies.
  • You must separate the tasks by using the "->" symbol and the ":given_delay" flag is not mandatory;
  • name_father_task_class:fixed_rate,given_delay)name_class_task1:given_delay->name_class_task2:given_delay->name_class_taskN:given_delay;
BitcoinInfo:120,10)BitcoinPrice:5->BitcoinEvaluate;
  • This task will be running every 2 minutes. The father task will get all the bitcoin info, waits for 10 seconds and schedule the dependency task BitcoinPrice. The BitcoinPrice will run, wait 5 seconds and pass the information to its dependency task BitcoinEvaluate to evaluate it.
  1. The syntax to run more than one father task in parallel.
  • You must separate the task by the symbol ";".
  • name_father_task_class:fixed_rate,given_delay)[dependencies];name_father_task_class:fixed_rate,given_delay)[dependencies];
SortingCreateArrays:60,5)SortingBubble;Fibonacci45:0,10);Fibonacci46:0,10);
  • In the example above, the SortingCreateArrays task will be running every 60 seconds. Fibonacci45 and Fibonacci46 tasks will run just once because the fixed_rate is 0 (zero).
  1. You cannot have a father task with sequential "->" and parallel "--" dependencies.
BitcoinInfo:120,10)BitcoinPrice:5->BitcoinEvaluate--Fibonacci46;

About

Small scheduler application in Java.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy