0% found this document useful (0 votes)
16 views3 pages

Java Task Scheduler Implementation

The java class schedules tasks to start and repeat at times specified in a properties file. It runs continuously until an end event is triggered by creating a file. The class reads the properties file to determine the start and repeat times for up to three tasks. When the end file is created, it waits for active tasks to finish and then ends.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

Java Task Scheduler Implementation

The java class schedules tasks to start and repeat at times specified in a properties file. It runs continuously until an end event is triggered by creating a file. The class reads the properties file to determine the start and repeat times for up to three tasks. When the end file is created, it waits for active tasks to finish and then ends.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Object This document describes a sample java class that is able to schedule task activities to start at the specified

time, and to repeat them at the specified time interval. Description Development environment: Eclipse Java EE IDE for Web Developers Java ersion %.&.' [Link] This class schedules the tasks accordin( to the timin( specified in properties file [Link]. The name of properties file is read as parameter. The main operations performed b) this class are: - to read the properties file - to check if one instance of the class is alread) active, in that case the "cheduler ends - to start and repeat the tasks: Task%, Task$, Task*, + - to catch the event to stop - to ,ait until all tasks are ended, and then end itself The class is runnin( until it receives the event to end. The event to end is raised ,hen is created the file specified in the parameter [Link] in the properties file. E-ample: If in the properties file [Link]=/sample/[Link], then ,hen the file [Link] is created in the folder /sample, le "cheduler ends. [Link] where N=1,2,3, This class is the activit) task. In the method performAction() is defined the activit) to e-ecute. para [Link] ersion: !elios "ervice #elease $

.ll parameters are in the properties file: [Link]. In the follo,in( table are described the parameters:

!ara

eters

Description Wait seconds bet,een t,o successive checks on runnin( tasks before end the "cheduler Wait seconds bet,een t,o successive checks on the re/uest to end the "cheduler alue: true0false. If true onl) one instance of the "cheduler can be active 1ame of the file the "cheduler creates ,hen it starts and deletes ,hen it ends 1ame of the file that the "cheduler checks ,hen it has been re/uested to end. This file is deleted b) the application just before endin( 2inutes after that task% starts 2inutes after that task% is repeated 2inutes after that task$ starts 2inutes after that task$ is repeated 2inutes after that task* starts 2inutes after that task* is repeated

[Link] [Link] [Link] [Link] [Link]

[Link].task1 [Link].task1 [Link].task2 [Link].task2 [Link].task3 [Link].task3 E-ample of ho, to start e repeat activities: [Link].task1=0 [Link].task1=

The activit) Task% starts immediatel) ,hen the "cheduler starts and is re-e-ecuted ever) 3 minutes. [Link].task2=1 [Link].task2=10 The activit) Task$ starts after % minute the "cheduler has started and is re-e-ecuted ever) %' minutes. [Link].task3=2 [Link].task3=1 The activit) Task* starts after $ minutes the "cheduler has started and is re-e-ecuted ever) %3 minutes.

"#ecution The script scheduler.!at"runs the "cheduler. #c$%&ro'ram"(iles"(x)*)%+,-%.ava*0%/re%!in%/[Link]#"0classpath"scheduler./ar" [Link].1cheduler"[Link] ,here: #c$%&ro'ram"(iles"(x)*)%+,-%.ava*0%/re%!in%/[Link]#: location of java.e-e

scheduler./ar: java packa(e [Link].1cheduler: java class to e-ecute [Link]: properties file

You might also like