JBOSS的调度问题??

07-02-03 okclip
任务只会执行一次。。但是如果把Period 86400000 改成60000毫秒的时候测试是每分钟都执行调度成功的。。有什么建议??

scheduler-service.xml 原文件:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE server>

<server>

<classpath codebase="lib"

archives="jboss-jmx.jar,

scheduler-plugin.jar,

framework.jar"/>

<!-- ==================================================================== -->

<!-- Scheduler Service -->

<!-- ==================================================================== -->

<!-- | The Schedule Manager has to be started whenever

| schedules are needed -->

<mbean code="org.jboss.varia.scheduler.ScheduleManager"

name="jboss:service=ScheduleManager">

<attribute name="StartAtStartup">true</attribute>

</mbean>

<!-- Nightly alert notification -->

<mbean code="com.fadv.tapa.util.scheduler.NightlyAlerts"

name="ScheduledTasks:service=NightlyAlerts">

<depends>jboss.jca:service=Hibernate</depends>

<attribute name="AlertName">NIGHTLY ALERT</attribute>

<attribute name="LastNDays">1</attribute>

</mbean>

<mbean code="com.fadv.tapa.core.schedule.jmx.SingleScheduleProvider"

name="TAPATasks:service=TaskScheduleProvider">

<depends>jboss:service=ScheduleManager</depends>

<depends>ScheduledTasks:service=NightlyAlerts</depends>

<attribute name="ScheduleManagerName">jboss:service=ScheduleManager</attribute>

<attribute name="TargetName">ScheduledTasks:service=NightlyAlerts</attribute>

<attribute name="TargetMethod">execute()</attribute>

<attribute name="DateFormat">h:mm a</attribute>

<attribute name="StartDate">NOW</attribute>

<attribute name="Period">86400000</attribute>

<attribute name="Repetitions">-1</attribute>

<attribute name="RegisterToScheduleManager">true</attribute>

</mbean>

</server>

1
okclip
2007-02-03 11:25

// <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>

<server>

  <classpath codebase="lib" 
	     archives="jboss-jmx.jar,
	     scheduler-plugin.jar, 
	     framework.jar"/>
	     
  <!-- ==================================================================== -->
  <!-- Scheduler Service                                                    -->
  <!-- ==================================================================== -->


  <!--  | The Schedule Manager has to be started whenever
    | schedules are needed   -->
   <mbean code="org.jboss.varia.scheduler.ScheduleManager"
          name="jboss:service=ScheduleManager">
      <attribute name="StartAtStartup">true</attribute>
   </mbean>


 	<!-- Nightly alert notification  -->

  <mbean code="com.fadv.tapa.util.scheduler.NightlyAlerts" 
	 name="ScheduledTasks:service=NightlyAlerts">
	 <depends>jboss.jca:service=Hibernate</depends>
      <attribute name="AlertName">NIGHTLY ALERT</attribute>
	  <attribute name="LastNDays">1</attribute>
  </mbean>

     <mbean code="com.fadv.tapa.core.schedule.jmx.SingleScheduleProvider"
            name="TAPATasks:service=TaskScheduleProvider">
        <depends>jboss:service=ScheduleManager</depends>
        <depends>ScheduledTasks:service=NightlyAlerts</depends>
        <attribute name="ScheduleManagerName">jboss:service=ScheduleManager</attribute>
        <attribute name="TargetName">ScheduledTasks:service=NightlyAlerts</attribute>
        <attribute name="TargetMethod">execute()</attribute>
        <attribute name="DateFormat">h:mm a</attribute>
        <attribute name="StartDate">NOW</attribute>
        <attribute name="Period">3600000</attribute>
        <attribute name="Repetitions">-1</attribute>
        <attribute name="RegisterToScheduleManager">true</attribute>
   </mbean>


</server>

<p>

banq
2007-02-09 16:39
JBoss 4以后调度使用的是Quartz实现的,可参考其用法来设置。

否则,就是JBoss 的BUG

JMX迟早要被淘汰,从你这个问题就可以看出,明明是Quartz设置,我却要隔靴JMX挠痒。组件应该彻底分离,直接面向用户配置。

猜你喜欢