]> git.mxchange.org Git - hub.git/commitdiff
Added a out-going work queue (FiFoStacker instance) to the test unit producer
authorRoland Häder <roland@mxchange.org>
Sat, 26 Mar 2011 17:27:39 +0000 (17:27 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 26 Mar 2011 17:27:39 +0000 (17:27 +0000)
application/hub/config.php
application/hub/main/producer/class_BaseProducer.php
application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php

index aad5e57ba2755ba6dac6ea3b7f99ad5b179f1c55..3b18d1b8ed2011ce878d882825d1ddd49a473c57 100644 (file)
@@ -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);
 
index 80f6c2afc54a010a083dddbf8733edd8b7186dae..2b20adeea3e121ea4fbc2a034d7f458fc9dacdce 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 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]
index b9a255c41ffe6c6afd968ee455ea69426b8bc442..d12697a24b8264f2362e0c8eb1da6226234d0a7d 100644 (file)
@@ -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