*/
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
*
$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->initStackers(array(
+ self::STACKER_NAME_IN_QUEUE,
+ self::STACKER_NAME_OUT_QUEUE
+ ));
// Output debug message
self::createDebugInstance(__CLASS__)->debugOutput('CRUNCHER: All buffers are now initialized.');
$stackerInstance = ObjectFactory::createObjectByConfiguredName('chunk_handler_stacker_class');
// Init all stacker
- $stackerInstance->initStacker(self::STACKER_NAME_CHUNKS_WITH_FINAL_EOP);
- $stackerInstance->initStacker(self::STACKER_NAME_CHUNKS_WITHOUT_FINAL);
- $stackerInstance->initStacker(self::STACKER_NAME_ASSEMBLED_RAW_DATA);
+ $stackerInstance->initStackers(array(
+ self::STACKER_NAME_CHUNKS_WITH_FINAL_EOP,
+ self::STACKER_NAME_CHUNKS_WITHOUT_FINAL,
+ self::STACKER_NAME_ASSEMBLED_RAW_DATA
+ ));
// Set the stacker in this handler
$handlerInstance->setStackerInstance($stackerInstance);
*/
private $incomingQueueInstance = NULL;
+ /**
+ * Stacker name for incoming work
+ */
+ const STACKER_NAME_IN_QUEUE = 'incoming_queue';
+
+ /**
+ * Stacker name for outgoing work
+ */
+ const STACKER_NAME_OUT_QUEUE = 'outgoing_queue';
+
/**
* Protected constructor
*
* @return void
*/
protected function initOutgoingQueue () {
- $this->getOutgoingQueueInstance()->initStacker('outgoing_queue', true);
+ $this->getOutgoingQueueInstance()->initStacker(self::STACKER_NAME_OUT_QUEUE, true);
}
/**
* @return void
*/
protected function addValueToOutgoingQueue ($value) {
- $this->getOutgoingQueueInstance()->pushNamed('outgoing_queue', $value);
+ $this->getOutgoingQueueInstance()->pushNamed(self::STACKER_NAME_OUT_QUEUE, $value);
}
/**
* @return $isReached Whether the limit is reached
*/
protected function isOutgoingQueueLimitReached($configEntry) {
- return ($this->getConfigInstance()->getConfigEntry($configEntry) <= $this->getOutgoingQueueInstance()->getStackCount('outgoing_queue'));
+ return ($this->getConfigInstance()->getConfigEntry($configEntry) <= $this->getOutgoingQueueInstance()->getStackCount(self::STACKER_NAME_OUT_QUEUE));
}
/**
* @return void
*/
protected function initIncomingQueue () {
- $this->getIncomingQueueInstance()->initStacker('incoming_queue', true);
+ $this->getIncomingQueueInstance()->initStacker(self::STACKER_NAME_IN_QUEUE, true);
}
/**
* @return void
*/
protected function addValueToIncomingQueue ($value) {
- $this->getIncomingQueueInstance()->pushNamed('incoming_queue', $value);
+ $this->getIncomingQueueInstance()->pushNamed(self::STACKER_NAME_IN_QUEUE, $value);
}
/**
* @return $isReached Whether the limit is reached
*/
protected function isIncomingQueueLimitReached($configEntry) {
- return ($this->getConfigInstance()->getConfigEntry($configEntry) <= $this->getIncomingQueueInstance()->getStackCount('incoming_queue'));
+ return ($this->getConfigInstance()->getConfigEntry($configEntry) <= $this->getIncomingQueueInstance()->getStackCount(self::STACKER_NAME_IN_QUEUE));
}
}