jsr236-experts@concurrency-ee-spec.java.net

[jsr236-experts] Factory class to create Trigger in EJB calendar-based timer format

From: Anthony Lai <anthony.lai_at_oracle.com>
Date: Wed, 12 Dec 2012 11:49:21 -0800

Dear experts,

I received suggestion to provide a factory class in
javax.enterprise.concurrent package that returns a Trigger given an
expression in the calendar-based time format as defined in the EJB spec.
Application developers can use this factory method to easily create more
complex Triggers to be submitted to MSES. For example, to submit a task
that fires every Monday at midnight:

ManagedScheduledExecutorService executor;

String expression = "dayOfWeek=\"Mon\"";
// creates a Trigger that runs every Monday at midnight
Trigger trigger = CronTriggerFactory.create(expression);
Callable task = ...
mese.schedule(task, trigger);

Should we add such factory class? Comments and suggestions are welcome.

Regards
Anthony