ScheduleFactory実装サービス jp.ossc.nimbus.service.scheduler.SimpleScheduleFactoryService

jp.ossc.nimbus.service.scheduler.SimpleScheduleFactoryServiceは、引数で指定されたキーと関係なく登録されているスケジュールを提供する単純なScheduleFactory実装サービスです。

このサービスは、複合的なサービスで、以下のサービスを下位サービスとして使用します。

下位サービスインタフェース用途
jp.ossc.nimbus.service.scheduler.Schedule提供するスケジュールとして使用する。
jp.ossc.nimbus.service.scheduler.ScheduleStateManagerスケジュールに設定する。

以下に簡単なサービス定義を示します。

  1. <?xml version="1.0" encoding="Shift_JIS"?>
  2. <!DOCTYPE server PUBLIC
  3. "-//Nimbus//DTD Nimbus 1.0//JA"
  4. "http://nimbus.sourceforge.jp/dtd/nimbus-service_1_0.dtd">
  5. <server>
  6. <manager>
  7. <!-- スケジュールファクトリサービス -->
  8. <service name="ScheduleFactory"
  9. code="jp.ossc.nimbus.service.scheduler.SimpleScheduleFactoryService">
  10. <!-- スケジュールサービスのサービス名を設定する -->
  11. <attribute name="ScheduleServiceNames">
  12. #Schedule1
  13. #Schedule2
  14. #Schedule3
  15. </attribute>
  16. <depends>Schedule1</depends>
  17. <depends>Schedule2</depends>
  18. <depends>Schedule3</depends>
  19. </service>
  20. <!-- スケジュール1
  21. スケジューラ起動の1秒後に1度だけ実行するスケジュール
  22. -->
  23. <service name="Schedule1"
  24. code="jp.ossc.nimbus.service.scheduler.TimerScheduleService">
  25. <attribute name="Name">Task1</attribute>
  26. <attribute name="Task">
  27. <object code="sample.task.SampleTask">
  28. <attribute name="Name">Task1</attribute>
  29. </object>
  30. </attribute>
  31. <attribute name="Delay">1000</attribute>
  32. </service>
  33. <!-- スケジュール2
  34. スケジューラ起動直後に実行され、1秒間隔で実行され続けるスケジュール
  35. -->
  36. <service name="Schedule2"
  37. code="jp.ossc.nimbus.service.scheduler.TimerScheduleService">
  38. <attribute name="Name">Task2</attribute>
  39. <attribute name="Task">
  40. <object code="sample.task.SampleTask">
  41. <attribute name="Name">Task2</attribute>
  42. </object>
  43. </attribute>
  44. <attribute name="Delay">0</attribute>
  45. <attribute name="Period">1000</attribute>
  46. </service>
  47. <!-- スケジュール3
  48. スケジューラ起動直後に実行され、1秒間隔で実行され続けるスケジュール
  49. 但し、タスクの処理時間が1.5秒かかるため、結果として1.5秒間隔で実行される。
  50. また、非同期処理用のキューを設定しているため、他のスケジュールの実行には影響を及ぼさない。
  51. -->
  52. <service name="Schedule3"
  53. code="jp.ossc.nimbus.service.scheduler.TimerScheduleService">
  54. <attribute name="Name">Task3</attribute>
  55. <attribute name="Task">
  56. <object code="sample.task.SampleTask">
  57. <attribute name="Name">Task3</attribute>
  58. <attribute name="ProcessTime">1500</attribute>
  59. </object>
  60. </attribute>
  61. <attribute name="Delay">0</attribute>
  62. <attribute name="Period">1000</attribute>
  63. <attribute name="QueueServiceName">Queue</attribute>
  64. <attribute name="DependsScheduleNames">Task1</attribute>
  65. <depends>
  66. <!-- 非同期処理用のキューサービス -->
  67. <service name="Queue"
  68. code="jp.ossc.nimbus.service.queue.DefaultQueueService"/>
  69. </depends>
  70. </service>
  71. </manager>
  72. </server>


スケジューラ/簡易スケジューラ/ScheduleFactory