Hi Geeks

The interface of the current Scheduler is going to explode.
But there is a lot of stuff I would like to add to come closer
to CRON etc.

1)

Currently the Scheduler can only contain one event on a
timely bases with a fixed period. If you have a Schedule
which runs every day at 12pm and 6pm then you need to
create to Schedulers. I would like to bring these 3 methods
together:
- setInitialStartDate
- setSchedulePeriod
- setInitialRepetitions

to this methods:
- public void setSchedules( String pSchedules )
the String will contain these pattern:
[ "Date" ] ; [ "Period" ] ; [ "Repetitions" ]
which is seperated by a '|' from each other.
A "Date" can be:
- milliseconds since 1/1/1970
- a constant: NOW, MONDAY - SUNDAY
   and it can have a "time pattern" added
- date pattern (see SimpleDateFormat) like "03/01/02 11:15am"
=> Default: NOW
A "Period" can be:
- milliseconds
- "time pattern" which is:
   i * DAY + k * HOUR + l * MINUTE + m
   (whereas i, k, l and m is a number and m is the number of milliseconds)
=> NO Default
A "Repetitions" is a long number of the initial repetitions or -1 if endless

With this you can create the schedule I mentioned above:
<argument name="Scheduler">12 * HOUR; 24 * HOUR; -1 | 18 * HOUR, 24 *
HOUR; -1</argument>
Because the Scheduler looks for the first date in the future it will find
12pm of the current or next day of
today when it starts at 12pm on 1/1/1970 (what 12 * HOUR) indicates.

When you need a Schedule which runs on Monday, Friday and Saturday on 11am
then it would look
like this:
<argument name="Scheduler">MONDAY + 11 * HOUR; 7 * DAY; -1 | FRIDAY + 11 *
HOUR; 7 * DAY; -1
   | SATURDAY + 11 * HOUR; 7 * DAY; -1 </argument>

And so on. Hope you get the idea.

This means that you need a Scheduler for each line in the CRON table.

2)
The Scheduler has many methods to define Schedulable Class or MBean. I would
like to take
the same approach and bring the together to one method call:

public void setTarget( String lSchedulable )

The String contains this pattern:

{ CLASS | MBEAN } "Target Name" [ "Method Name" ] ( "Attribute", ... )

A "Target Name" is either:
- the fully qualified Class name of a class implementing the Schedulable
interface
- the JMX ObjectName of the MBean to be called
A "Method Name" is if MBEAN is set:
- the method name to be called on the MBean
A "Attribute is either:
- a constant (only for MBEAN) like NOTIFICATION, DATE, REPETITIONS or
SCHEDULER_NAME
- a fully qualified class name where the value will be: null
- a String value seperated by '/' with the fully qualified class name
  in this case the constructor taking a String as single attribute will be
called to create the object

As example I want to call MBean "jboss:name=schedulerexample" with method
"public void hit( Date pDate, String pGreetings )"
when an event is sent from the timer. This settings would look like:
<attribute name="Target">MBEAN jboss:name=schedulerexample hit ( DATE, "Hi
Bob" / java.lang.String )</attribute>

See ya

xxxxxxxxxxxxxxxxx
Andreas Schaefer
Senior Consultant
JBoss Group, LLC
xxxxxxxxxxxxxxxxx



_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to