-
Patch
-
Resolution: Obsolete
-
Major
-
JBossAS-4.0.3 SP1
-
None
-
I work with solaris 9 and eclipse 3.1.1 / jbosside 1.5
I've added to the param "NOW", the manner to scheduler the time. Then you cannot need to specify the today's date if you want a scheduler by only time. I've added also a param "TOMORROW", so it's maybe to use my update with the AM time. I modified the method setStartDate(String pStartDate) so:
public void setStartDate(String pStartDate) {
mStartDateString = pStartDate == null ? "" : pStartDate.trim();
if (mStartDateString.equals(""))
else if (mStartDateString.startsWith("NOW") || mStartDateString.startsWith("TOMORROW")) {
if (mStartDateString.equals("NOW"))
mStartDate = new Date(new Date().getTime() + 1000);
else if (mStartDateString.equals("TOMORROW"))
mStartDate = new Date(new Date().getTime() + 86400000);
else {
if (mDateFormatter == null)
String dateString = mStartDateString.startsWith("NOW") ?
mDateFormatter.format(new Date(new Date().getTime() + 1000)) :
mDateFormatter.format(new Date(new Date().getTime() + 86400000));
String timeString = mStartDateString.startsWith("NOW") ?
mStartDateString.substring(3) :
mStartDateString.substring(8);
String date = dateString.substring(0, dateString.length()
- timeString.length() - 1)
+ timeString;
try { mStartDate = mDateFormatter.parse(date); }catch (Exception e2)
{ log.error("Could not parse given date string: " + mStartDateString, e2); throw new InvalidParameterException( "Schedulable Date is not of correct format"); }}
{ long lDate = new Long(pStartDate).longValue(); mStartDate = new Date(lDate); }
} else {
trycatch (Exception e) {
tryUnknown macro: { if (mDateFormatter == null) { mDateFormatter = new SimpleDateFormat(); } mStartDate = mDateFormatter.parse(mStartDateString); }catch (Exception e2)
{ log.error("Could not parse given date string: " + mStartDateString, e2); throw new InvalidParameterException( "Schedulable Date is not of correct format"); }}
}
log.debug("Initial Start Date is set to: " + mStartDate);
}
the scheduler can to configure so:
<mbean code="org.jboss.varia.scheduler.SingleScheduleProvider"
name="jboss:service=SingleScheduleProvider">
<depends>jboss:service=ScheduleManager</depends>
<depends>jboss:service=SchedulableMBeanExample</depends>
<attribute name="ScheduleManagerName">jboss:service=ScheduleManager</attribute>
<attribute name="TargetName">jboss:service=SchedulableMBeanAlboStatico</attribute>
<attribute name="TargetMethod">hit( NOTIFICATION, DATE, REPETITIONS, SCHEDULER_NAME, java.lang.String )</attribute>
<attribute name="DateFormat">dd/MM/yyyy-hh:mm:ss</attribute>
<attribute name="StartDate">NOW-23:30:00</attribute>
<attribute name="Period">86400000</attribute>
<attribute name="Repetitions">-1</attribute>
</mbean>
DateFormat must to be compatible with startDate , else a Exception will throw