]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/cruncher/class_BaseHubCruncher.php
Renamed 'stacker' -> 'stack'
[hub.git] / application / hub / main / cruncher / class_BaseHubCruncher.php
index 9eab56368d414695657e594bac89ff2d2a6f5b3a..0f68adc7c27cd3d1314eb6fec06f2d2989b7eaba 100644 (file)
@@ -30,13 +30,23 @@ abstract class BaseHubCruncher extends BaseHubSystem implements Updateable {
        /**
         * By default no cruncher is active
         */
-       private $isActive = false;
+       private $isActive = FALSE;
 
        /**
         * All buffer queue instances (a FIFO)
         */
        private $bufferInstance = NULL;
 
+       /**
+        * Stacker name for incoming queue
+        */
+       const STACKER_NAME_IN_QUEUE = 'in_queue';
+
+       /**
+        * Stacker name for outcoming queue
+        */
+       const STACKER_NAME_OUT_QUEUE = 'out_queue';
+
        /**
         * Protected constructor
         *
@@ -88,7 +98,7 @@ abstract class BaseHubCruncher extends BaseHubSystem implements Updateable {
         */
        protected function isInBufferQueueFilled () {
                // Determine it
-               $isFilled = ($this->bufferInstance->getStackCount('in_queue') > $this->getConfigInstance()->getConfigEntry('cruncher_in_buffer_min_threshold'));
+               $isFilled = ($this->bufferInstance->getStackCount(self::STACKER_NAME_IN_QUEUE) > $this->getConfigInstance()->getConfigEntry('cruncher_in_buffer_min_threshold'));
 
                // And return the result
                return $isFilled;
@@ -121,7 +131,7 @@ abstract class BaseHubCruncher extends BaseHubSystem implements Updateable {
         * @param       $version        Version number of this cruncher
         * @return      void
         */
-       public final function enableIsActive ($isActive = true) {
+       public final function enableIsActive ($isActive = TRUE) {
                $this->isActive = (bool) $isActive;
        }
 
@@ -148,8 +158,10 @@ abstract class BaseHubCruncher extends BaseHubSystem implements Updateable {
                $this->bufferInstance = ObjectFactory::createObjectByConfiguredName('cruncher_buffer_stacker_class');
 
                // Initialize common stackers, like in/out
-               $this->bufferInstance->initStacker('in_queue');
-               $this->bufferInstance->initStacker('out_queue');
+               $this->bufferInstance->initStacks(array(
+                       self::STACKER_NAME_IN_QUEUE,
+                       self::STACKER_NAME_OUT_QUEUE
+               ));
 
                // Output debug message
                self::createDebugInstance(__CLASS__)->debugOutput('CRUNCHER: All buffers are now initialized.');