THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
- The ServiceMix container reads the
servicemix.xml
file and sees it needs to instantiate a FilePoller. - The container calls the init() method of FilePoller as well as the init() methods of its parents.
- The container determines that FilePoller is an MBean and, therefore, calls the start() method of FilePoller, which it inherits from its parent PollingComponentSupport.
- The start() method will:
a. Create a timerTask, which overrides the run() method inline, the run() method will eventually get the WorkManager and schedule work.
b. Schedule the the timerTask at a fixed rate. The start() method uses the "timer" (created in the init () method) to schedule the timerTask at a fixed rate, : timer.scheduleAtFixedRate(timerTask, firstTime, period). Recall "period" is a property of FilePoller. It was assigned the value of 1000ms by dependency injection from theservicemix.xml
file.
c. timer will call the run() method of the timerTask periodically.
d. timerTask's run method() is defined inline. It will get the workManager object (see below for details).
e. The workManager will call scheduleWork(PollingComponentSupport.this). Note: it passes in PollingComponent support, which by virtue of its inheritance hierarchy, is also of type "Work", which is a "Runnable."
f. workManager.scheduleWork(Work) will likely create or get a Thread, passing in a Runnable object, i.e. PollingComponentSupport, and call its run() method
g. PollingComponent's run() method calls poll(), which is implemented in FilePoller.
h. From this point on the call sequence can be followed in FilePoller...
i. The start() method of PollingComponentSupport, will eventually calls super.start(), which propagates up to call the start() method of BaseLifeCycle, which sets the component state to "RUNNING."
Eventually, the
workManager Details
workManager is a property of the FilePoller object. This property is defined by a local reference, the "ref" attribute in the servicemix.xml
file. The local reference is a bean which instantiates org.activemq.work.SpringWorkManager.
...