Read-Me for Demo Schedule
DOWNLOAD FILES
This sample demonstrates the Dynamo scheduling. We will set up a scheduled
job, and log the number of active sessions to the info log according to the
defined schedule. We'll also see how to automatically start the service every
time the server is started.
This sample can be used as a template for any scheduled task simply by
modifying the performScheduledTask method of the SessionReporter class.
- Extract files into <DYNAMO_HOME>\demoschedule
- Start dynamo with -m demoschedule to enable the demo
Notes
Exercise
In this exercise you'll add a new scheduled job to report the number of
active sessions to the console every 5 minutes
- Examine the source code of demoschedule.SessionReporter
- Note the implementation of the
atg.service.scheduler.Schedulable
interface
- Note the SessionManager property which is used to access the current
session information
- Take a look at the schedule and scheduler properties (what are these
for?)
- Every GenericService class gets doStartService and doStopService (What
are we doing in these methods?)
- Compile demoschedule.SessionReporter and ensure the class file is on the
classpath. (If you are running the
- Create a new globally scoped component called /demoschedule/SessionReporter
of class demoschedule.SessionReporter
- Ensure that the sessionManager property is set to the dynamo session
manager (can you find it?)
- Set the schedule to 'every 2 minutes' (Why does this work?)
- Set the scheduler to the global scheduler (Can you find this?)
- Start the component, Does the SessionReporter work correctly?
Additional Steps
With something like this, we might want the component to be started
automatically when the server starts. The InitialService component in
/atg/Dynamo maintains a list of components to start automatically.
- Add the SessionReporter to the initial services list (Can you find this?)
Solution
The solution files for this exercise can be found in the solution folder.
|