]
Luca Stancapiano commented on JBAS-2596:
----------------------------------------
respond me please
org.jboss.varia.scheduler.SingleSchedulerProvider
-------------------------------------------------
Key: JBAS-2596
URL:
http://jira.jboss.com/jira/browse/JBAS-2596
Project: JBoss Application Server
Issue Type: Patch
Security Level: Public(Everyone can see)
Components: Management services
Affects Versions: JBossAS-4.0.3 SP1
Environment: I work with solaris 9 and eclipse 3.1.1 / jbosside 1.5
Reporter: Luca Stancapiano
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("")) {
mStartDate = new Date(0);
} 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) {
mDateFormatter = new SimpleDateFormat();
}
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");
}
}
} else {
try {
long lDate = new Long(pStartDate).longValue();
mStartDate = new Date(lDate);
} catch (Exception e) {
try {
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
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: