From: Roland Häder Date: Sat, 26 Mar 2011 17:27:39 +0000 (+0000) Subject: Added a out-going work queue (FiFoStacker instance) to the test unit producer X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d5598a16aba413db79b4e319cfabfb62da29d364;p=hub.git Added a out-going work queue (FiFoStacker instance) to the test unit producer --- diff --git a/application/hub/config.php b/application/hub/config.php index aad5e57ba..3b18d1b8e 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -273,6 +273,9 @@ $cfg->setConfigEntry('network_package_stacker_class', 'FiFoStacker'); // CFG: CRUNCHER-BUFFER-STACKER-CLASS $cfg->setConfigEntry('cruncher_buffer_stacker_class', 'FiFoStacker'); +// CFG: PRODUCER-OUTGOING-WORK-QUEUE +$cfg->setConfigEntry('producer_outgoing_work_queue', 'FiFoStacker'); + // CFG: STACKER-ANNOUNCEMENT-MAX-SIZE $cfg->setConfigEntry('stacker_announcement_max_size', 20); @@ -297,6 +300,9 @@ $cfg->setConfigEntry('stacker_out_queue_max_size', 10000); // CFG: STACKER-OBJECT-REGISTRY-MAX-SIZE $cfg->setConfigEntry('stacker_object_registry_max_size', 100); +// CFG: STACKER-WORK-QUEUE-MAX-SIZE +$cfg->setConfigEntry('stacker_work_queue_max_size', 1000); + // CFG: NEWS-MAIN-LIMIT $cfg->setConfigEntry('news_main_limit', 5); diff --git a/application/hub/main/producer/class_BaseProducer.php b/application/hub/main/producer/class_BaseProducer.php index 80f6c2afc..2b20adeea 100644 --- a/application/hub/main/producer/class_BaseProducer.php +++ b/application/hub/main/producer/class_BaseProducer.php @@ -22,6 +22,11 @@ * along with this program. If not, see . */ abstract class BaseProducer extends BaseFrameworkSystem { + /** + * Out-going work-queue + */ + private $outgoingQueueInstance = null; + /** * Protected constructor * @@ -34,6 +39,28 @@ abstract class BaseProducer extends BaseFrameworkSystem { // Initialize all producers $this->initProducer(); + + // Initialize work queue (out-going, produced items) + $this->initWorkQueue(); + } + + /** + * Setter for out-going work queue + * + * @param $outgoingQueueInstance The out-going work queue instance + * @return void + */ + private function setOutgoingQueueInstance (Stackable $outgoingQueueInstance) { + $this->outgoingQueueInstance = $outgoingQueueInstance; + } + + /** + * Getter for out-going work queue + * + * @param $outgoingQueueInstance The out-going work queue instance + */ + protected function getOutgoingQueueInstance () { + return $this->outgoingQueueInstance; } /** @@ -42,6 +69,23 @@ abstract class BaseProducer extends BaseFrameworkSystem { * @return void */ abstract protected function initProducer(); + + /** + * Initializes the work queue which is being used for out-going, produced + * items. + * + * @return void + */ + protected function initWorkQueue () { + // Get an instance and set it in this producer + $this->setOutgoingQueueInstance(ObjectFactory::createObjectByConfiguredName('producer_outgoing_work_queue')); + + // Init the queue + $this->getOutgoingQueueInstance()->initStacker('work_queue'); + + // Debug message + $this->debugOutput('PRODUCER: Out-going work queue initialized.'); + } } // [EOF] diff --git a/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php b/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php index b9a255c41..d12697a24 100644 --- a/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php +++ b/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php @@ -66,7 +66,7 @@ class CruncherTestUnitProducer extends BaseProducer implements UnitProducer, Reg } /** - * Produces some work/test units and pushes them onto the queue + * Produces some test units and pushes them onto the queue * * @return void * @todo 0% done