@@ -535,7 +535,7 @@ class Launcher : public PluginHost::IPlugin {
535535 };
536536
537537public:
538- class Job : public Core ::IDispatch {
538+ class Job {
539539 private:
540540 typedef std::vector<uint32_t > ProcessList;
541541
@@ -554,6 +554,7 @@ class Launcher : public PluginHost::IPlugin {
554554 , _shutdownPhase(0 )
555555 , _processListEmpty(1 , 1 )
556556 , _shutdownCompleted(false )
557+ , _job(*this )
557558 {
558559 auto iter = config->Parameters .Elements ();
559560
@@ -572,8 +573,9 @@ class Launcher : public PluginHost::IPlugin {
572573 }
573574 _memory->AddRef ();
574575 }
575- ~Job () override
576+ ~Job ()
576577 {
578+ _job.Revoke ();
577579 _memory->Release ();
578580 }
579581
@@ -629,18 +631,18 @@ class Launcher : public PluginHost::IPlugin {
629631 }
630632 void Schedule (const Core::Time& time) {
631633 if (time <= Core::Time::Now ()) {
632- PluginHost::WorkerPool::Instance () .Submit (Core::ProxyType<Core::IDispatch>(* this ) );
634+ _job .Submit ();
633635 }
634636 else {
635- PluginHost::WorkerPool::Instance (). Schedule (time, Core::ProxyType<Core::IDispatch>(* this ) );
637+ _job. Reschedule (time);
636638 }
637639 }
638640 void Shutdown () {
639641 _adminLock.Lock ();
640642 _shutdownPhase = 1 ;
641643 _adminLock.Unlock ();
642644
643- PluginHost::WorkerPool::Instance () .Revoke (Core::ProxyType<Core::IDispatch>(* this ) );
645+ _job .Revoke ();
644646 if (_process.IsActive () == true ) {
645647
646648 // First try a gentle touch....
@@ -677,11 +679,15 @@ class Launcher : public PluginHost::IPlugin {
677679 }
678680
679681 private:
680- string Identifier () const override {
682+ string JobIdentifier () const
683+ {
681684 return (_T (" Launcher::Command(\" " ) + _options.Command () + _T (" \" )" ));
682685 }
683- void Dispatch () override
686+
687+ friend Core::ThreadPool::JobType<Job&>;
688+ void Dispatch ()
684689 {
690+ TRACE (Trace::Information, (_T (" Launcher: job is dispatched" )));
685691 // Let limit the jitter on the next run, if required..
686692 Core::Time nextRun (Core::Time::Now ());
687693
@@ -704,7 +710,7 @@ class Launcher : public PluginHost::IPlugin {
704710 if (_shutdownPhase == 0 ) {
705711 // Reschedule our next launch point...
706712 nextRun.Add (_interval.TimeInSeconds () * Time::MilliSecondsPerSecond);
707- PluginHost::WorkerPool::Instance (). Schedule (nextRun, Core::ProxyType<Core::IDispatch>(* this ) );
713+ _job. Reschedule (nextRun);
708714 }
709715 _adminLock.Unlock ();
710716 }
@@ -721,6 +727,8 @@ class Launcher : public PluginHost::IPlugin {
721727 ProcessList _processList;
722728 Core::Event _processListEmpty;
723729 Core::BinairySemaphore _shutdownCompleted;
730+
731+ Core::WorkerPool::JobType<Job&> _job;
724732 };
725733
726734public:
0 commit comments