1

たとえば、次の2つのタスクがあります。

  <mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=Scheduler">
    <attribute name="StartAtStartup">true</attribute>
    <attribute name="SchedulableClass">Scheduler1</attribute>
    <attribute name="InitialStartDate">NOW</attribute>
    <attribute name="SchedulePeriod">60</attribute>
    <attribute name="InitialRepetitions">-1</attribute>
    <attribute name="FixedRate">false</attribute>
  </mbean>

  <mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=Scheduler2">
    <attribute name="StartAtStartup">true</attribute>
    <attribute name="SchedulableClass">Scheduler2</attribute>
    <attribute name="InitialStartDate">NOW</attribute>
    <attribute name="SchedulePeriod">3600</attribute>
    <attribute name="InitialRepetitions">-1</attribute>
    <attribute name="FixedRate">false</attribute>
  </mbean>

つまり、最初は1分ごとに、2番目は1時間ごとにスケジュールされます。

問題は、2番目のタスクの実行に5分かかる場合、最初のタスクはこの時間中に実行されず、2番目のタスクが完了するまで待機することです。

それらを並行して動作させる方法はありますか?それとも、クォーツか何か他のものに移動する必要がありますか?

4

1 に答える 1

1

使用する

<attribute name="TimerName">jboss:service=TimerNew</attribute>

並行してスケジュールを開始します。

于 2012-04-11T20:26:03.403 に答える