]> git.mxchange.org Git - hub.git/commitdiff
Some speed-up hacks
authorRoland Häder <roland@mxchange.org>
Sun, 3 Feb 2013 05:58:03 +0000 (05:58 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 3 Feb 2013 05:58:03 +0000 (05:58 +0000)
application/hub/main/tasks/network/class_NetworkPackageReaderTask.php
application/hub/main/tasks/network/class_NetworkPackageWriterTask.php

index 6a008d0708debc6f543d466ba65c633f7acf0cf1..d86e58d618237cbcb7caa2580998eb5c14983e5c 100644 (file)
@@ -73,15 +73,18 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable {
         * @return      void
         */
        public function executeTask () {
+               // "Cache" package instance
+               $packageInstance = $this->getPackageInstance();
+
                // Do we have something to handle?
-               if ($this->getPackageInstance()->isProcessedMessagePending()) {
+               if ($packageInstance->isProcessedMessagePending()) {
                        /*
                         * A previously proccessed message is waiting for being
                         * "interpreted". This is done by trying to find a configuration
                         * entry based on 'message_type' element.
                         */
-                       $this->getPackageInstance()->handleProcessedMessage();
-               } elseif ($this->getPackageInstance()->isNewMessageArrived()) {
+                       $packageInstance->handleProcessedMessage();
+               } elseif ($packageInstance->isNewMessageArrived()) {
                        /*
                         * A fully "decoded" message has been received and added for being
                         * processed. Processing a message should not take long, so mostly
@@ -89,20 +92,20 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable {
                         * as "XML variables" from the content (which must be a well-formed
                         * XML) and then pushing it on the next stack "processed messages".
                         */
-                       $this->getPackageInstance()->handleNewlyArrivedMessage();
-               } elseif ($this->getPackageInstance()->isIncomingRawDataHandled()) {
+                       $packageInstance->handleNewlyArrivedMessage();
+               } elseif ($packageInstance->isIncomingRawDataHandled()) {
                        /*
                         * Incoming decoded data has been handled (see below) so it needs to
                         * be assembled back to a "package array". Please see NetworkPackage
                         * for further details (what array elements are required et cetera).
                         */
-                       $this->getPackageInstance()->assembleDecodedDataToPackage();
-               } elseif ($this->getPackageInstance()->isNewRawDataPending($this->getListenerPoolInstance())) {
+                       $packageInstance->assembleDecodedDataToPackage();
+               } elseif ($packageInstance->isNewRawDataPending($this->getListenerPoolInstance())) {
                        // Raw, decoded data has been received
-                       $this->getPackageInstance()->handleIncomingDecodedData();
-               } elseif ($this->getPackageInstance()->ifAssemblerHasPendingDataLeft()) {
+                       $packageInstance->handleIncomingDecodedData();
+               } elseif ($packageInstance->ifAssemblerHasPendingDataLeft()) {
                        // Handle any pending data from the package assembler
-                       $this->getPackageInstance()->handleAssemblerPendingData();
+                       $packageInstance->handleAssemblerPendingData();
                } // END - if
        }
 }
index ef9a70ef42d2e23deb64d194d4c4a8d5332298ce..6a8eb2849e0613f88ad2aa4dfe30e6140abb0eea 100644 (file)
@@ -69,16 +69,19 @@ class NetworkPackageWriterTask extends BaseTask implements Taskable, Visitable {
         * @return      void
         */
        public function executeTask () {
+               // "Cache" package instance
+               $packageInstance = $this->getPackageInstance();
+
                // Do we have something to deliver?
-               if ($this->getPackageInstance()->isPackageWaitingForDelivery()) {
+               if ($packageInstance->isPackageWaitingForDelivery()) {
                        // Sent it finally out
-                       $this->getPackageInstance()->sendWaitingPackage();
-               } elseif ($this->getPackageInstance()->isPackageDeclared()) {
+                       $packageInstance->sendWaitingPackage();
+               } elseif ($packageInstance->isPackageDeclared()) {
                        // Prepare package for delivery
-                       $this->getPackageInstance()->deliverDeclaredPackage();
-               } elseif ($this->getPackageInstance()->isPackageEnqueued()) {
+                       $packageInstance->deliverDeclaredPackage();
+               } elseif ($packageInstance->isPackageEnqueued()) {
                        // Okay, then deliver (better discover its recipients) this package
-                       $this->getPackageInstance()->declareEnqueuedPackage();
+                       $packageInstance->declareEnqueuedPackage();
                }
        }
 }