]> git.mxchange.org Git - hub.git/commitdiff
More shutdown filters added, interface introduced
authorRoland Häder <roland@mxchange.org>
Tue, 4 Aug 2009 00:27:45 +0000 (00:27 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 4 Aug 2009 00:27:45 +0000 (00:27 +0000)
- Shutdown filter for deinit of queues/queries and listener pool added
- All listeners and listener decorators are now Visitable (see below)
- Interface 'Visitable' introduced which we will use for the Visitor Pattern
- Duplicate 'Shutdown' in class name and config entry removed

17 files changed:
.gitattributes
application/hub/class_ApplicationHelper.php
application/hub/config.php
application/hub/interfaces/listener/class_Listenable.php
application/hub/interfaces/visitor/.htaccess [new file with mode: 0644]
application/hub/interfaces/visitor/class_Visitable.php [new file with mode: 0644]
application/hub/main/commands/console/class_HubConsoleMainCommand.php
application/hub/main/filter/shutdown/class_HubShutdown
application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php [new file with mode: 0644]
application/hub/main/filter/shutdown/class_HubShutdownListenerPoolFilter.php [new file with mode: 0644]
application/hub/main/filter/shutdown/class_HubShutdownNodeFilter.php [new file with mode: 0644]
application/hub/main/filter/shutdown/class_HubShutdownShutdownNodeFilter.php [deleted file]
application/hub/main/listener/class_
application/hub/main/listener/class_BaseListener.php
application/hub/main/listener/class_BaseListenerDecorator.php
application/hub/main/nodes/class_BaseHubNode.php
application/hub/main/pools/class_BasePool.php

index 093115c13f367070dc9297ebddad84d721af9746..7d24211cdd52b3eabc187d7c708815d7dc0fa904 100644 (file)
@@ -31,6 +31,8 @@ application/hub/interfaces/states/client/.htaccess -text
 application/hub/interfaces/states/client/class_ClientStateable.php -text
 application/hub/interfaces/states/hub/.htaccess -text
 application/hub/interfaces/states/hub/class_HubStateable.php -text
+application/hub/interfaces/visitor/.htaccess -text
+application/hub/interfaces/visitor/class_Visitable.php -text
 application/hub/loader.php -text
 application/hub/main/.htaccess -text
 application/hub/main/class_ -text
@@ -78,8 +80,10 @@ application/hub/main/filter/node/class_Node -text
 application/hub/main/filter/node/class_NodeInitializationFilter.php -text
 application/hub/main/filter/shutdown/.htaccess -text
 application/hub/main/filter/shutdown/class_HubShutdown -text
+application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php -text
 application/hub/main/filter/shutdown/class_HubShutdownFlushNodeListFilter.php -text
-application/hub/main/filter/shutdown/class_HubShutdownShutdownNodeFilter.php -text
+application/hub/main/filter/shutdown/class_HubShutdownListenerPoolFilter.php -text
+application/hub/main/filter/shutdown/class_HubShutdownNodeFilter.php -text
 application/hub/main/listener/.htaccess -text
 application/hub/main/listener/class_ -text
 application/hub/main/listener/class_BaseListener.php -text
index 74f32fea9924a7a91fe436fe57fcb2da312291cf..b146c97447882f6ca3053a743dd984a0cd39083d 100644 (file)
@@ -208,7 +208,9 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                // -------------------------- Shutdown phase --------------------------
                // Shutting down the hub by saying "good bye" to all connected clients
                // and other hubs, flushing all queues and caches.
+               $this->debugOutput('MAIN: Shutdown in progress, main loop exited.');
                $this->getControllerInstance()->executeShutdownFilters($requestInstance, $responseInstance);
+               $this->debugOutput('MAIN: Shutdown completed. (This is the last line.)');
        }
 
        /**
index 9779811228aa69c3435f706bdd4afce4e5b92c35..3a549b1ba13836e7ce854b24fa046402144cee70 100644 (file)
@@ -126,8 +126,14 @@ $cfg->setConfigEntry('hub_bootstrap_listener_pool_filter', 'HubBootstrapListener
 // CFG: HUB-SHUTDOWN-FLUSH-NODE-LIST-FILTER
 $cfg->setConfigEntry('hub_shutdown_flush_node_list_filter', 'HubShutdownFlushNodeListFilter');
 
-// CFG: HUB-SHUTDOWN-SHUTDOWN-NODE-FILTER
-$cfg->setConfigEntry('hub_shutdown_shutdown_node_filter', 'HubShutdownShutdownNodeFilter');
+// CFG: HUB-SHUTDOWN-DEINIT-QUEUES-FILTER
+$cfg->setConfigEntry('hub_shutdown_deinit_queues_filter', 'HubShutdownDeinitQueuesFilter');
+
+// CFG: HUB-SHUTDOWN-LISTENER-POOL-FILTER
+$cfg->setConfigEntry('hub_shutdown_listener_pool_filter', 'HubShutdownListenerPoolFilter');
+
+// CFG: HUB-SHUTDOWN-NODE-FILTER
+$cfg->setConfigEntry('hub_shutdown_node_filter', 'HubShutdownNodeFilter');
 
 // CFG: NEWS-READER-CLASS
 $cfg->setConfigEntry('news_reader_class', 'ConsoleNewsReader');
index ede2b555fe56d23b9265718ba28f38158bc8067f..a8e9ed30bb2e9181ee4ca710869de720b301d256 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-interface Listenable extends FrameworkInterface {
+interface Listenable {
        /**
         * Initializes the listener by setting up the required socket server
         *
diff --git a/application/hub/interfaces/visitor/.htaccess b/application/hub/interfaces/visitor/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/visitor/class_Visitable.php b/application/hub/interfaces/visitor/class_Visitable.php
new file mode 100644 (file)
index 0000000..f91e448
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * An interface for the visitor pattern
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface Visitable extends FrameworkInterface {
+}
+
+//
+?>
index 13bec9ac151f955167a25311785a7679c1688260..3030c48b6aea59c0e8babc7d592f41313d464eca 100644 (file)
@@ -127,7 +127,11 @@ class HubConsoleMainCommand extends BaseCommand implements Commandable {
 
                // Add shutdown filters
                $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('hub_shutdown_flush_node_list_filter'));
-               $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('hub_shutdown_shutdown_node_filter'));
+               $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('hub_shutdown_deinit_queues_filter'));
+               $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('hub_shutdown_listener_pool_filter'));
+
+               // This is the last filter
+               $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('hub_shutdown_node_filter'));
        }
 }
 
index 42421215c3c6d6672e6db2668e986ba16a2dd658..e5bf7332111cd2f5d786132291ae78f79127a72c 100644 (file)
@@ -71,76 +71,3 @@ class HubShutdown???Filter extends BaseFilter implements Filterable {
 
 // [EOF]
 ?>
-<?php
-/**
- * A ??? filter for shutting down the node.
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class HubShutdown???Filter extends BaseFilter implements Filterable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this filter class
-        *
-        * @return      $filterInstance         An instance of this filter class
-        */
-       public final static function createHubShutdown???Filter () {
-               // Get a new instance
-               $filterInstance = new HubShutdown???Filter();
-
-               // Return the instance
-               return $filterInstance;
-       }
-
-       /**
-        * Executes the filter with given request and response objects
-        *
-        * @param       $requestInstance        An instance of a class with an Requestable interface
-        * @param       $responseInstance       An instance of a class with an Responseable interface
-        * @return      void
-        * @throws      FilterChainException    If $nodeInstance is null (no NullPointerException here)
-        * @todo        0% done
-        */
-       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // Get node instance
-               $nodeInstance = Registry::getRegistry()->getInstance('node');
-
-               // Sanity-check on it
-               if (is_null($nodeInstance)) {
-                       // Throws a FilterChainException to stop further processing
-                       throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
-               } // END - if
-
-               // Now do something
-               $this->partialStub('Please implement this step.');
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php b/application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php
new file mode 100644 (file)
index 0000000..299cc7c
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+/**
+ * A DeinitQueues filter for shutting down the node.
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class HubShutdownDeinitQueuesFilter extends BaseFilter implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this filter class
+        *
+        * @return      $filterInstance         An instance of this filter class
+        */
+       public final static function createHubShutdownDeinitQueuesFilter () {
+               // Get a new instance
+               $filterInstance = new HubShutdownDeinitQueuesFilter();
+
+               // Return the instance
+               return $filterInstance;
+       }
+
+       /**
+        * Executes the filter with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        * @throws      FilterChainException    If $nodeInstance is null (no NullPointerException here)
+        * @todo        0% done
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get node instance
+               $nodeInstance = Registry::getRegistry()->getInstance('node');
+
+               // Sanity-check on it
+               if (is_null($nodeInstance)) {
+                       // Throws a FilterChainException to stop further processing
+                       throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
+               } // END - if
+
+               // Get query instance
+               $queryInstance = $nodeInstance->getQueryInstance();
+
+               // Sanity-check on it
+               if (is_null($queryInstance)) {
+                       // Throws a FilterChainException to stop further processing
+                       throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
+               } // END - if
+
+               // Now shutdown this one done
+               $queryInstance->doShutdown();
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/filter/shutdown/class_HubShutdownListenerPoolFilter.php b/application/hub/main/filter/shutdown/class_HubShutdownListenerPoolFilter.php
new file mode 100644 (file)
index 0000000..5a1e79d
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+/**
+ * A ListenerPool filter for shutting down the node.
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class HubShutdownListenerPoolFilter extends BaseFilter implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this filter class
+        *
+        * @return      $filterInstance         An instance of this filter class
+        */
+       public final static function createHubShutdownListenerPoolFilter () {
+               // Get a new instance
+               $filterInstance = new HubShutdownListenerPoolFilter();
+
+               // Return the instance
+               return $filterInstance;
+       }
+
+       /**
+        * Executes the filter with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        * @throws      FilterChainException    If $nodeInstance is null (no NullPointerException here)
+        * @todo        0% done
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get node instance
+               $nodeInstance = Registry::getRegistry()->getInstance('node');
+
+               // Sanity-check on it
+               if (is_null($nodeInstance)) {
+                       // Throws a FilterChainException to stop further processing
+                       throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
+               } // END - if
+
+               // Get listener pool instance
+               $listenerPoolInstance = $nodeInstance->getListenerPoolInstance();
+
+               // Sanity-check on it
+               if (is_null($listenerPoolInstance)) {
+                       // Throws a FilterChainException to stop further processing
+                       throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
+               } // END - if
+
+               // Now shutdown this one done
+               $listenerPoolInstance->doShutdown();
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/filter/shutdown/class_HubShutdownNodeFilter.php b/application/hub/main/filter/shutdown/class_HubShutdownNodeFilter.php
new file mode 100644 (file)
index 0000000..826acd4
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+/**
+ * A ShutdownNode filter for shutting down the node. This filter should be the
+ * last one in 'shutdown' chain so the hub is shutted down at the very end of
+ * its life... R.I.P. little hub...
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class HubShutdownNodeFilter extends BaseFilter implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this filter class
+        *
+        * @return      $filterInstance         An instance of this filter class
+        */
+       public final static function createHubShutdownNodeFilter () {
+               // Get a new instance
+               $filterInstance = new HubShutdownNodeFilter();
+
+               // Return the instance
+               return $filterInstance;
+       }
+
+       /**
+        * Executes the filter with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        * @throws      FilterChainException    If $nodeInstance is null (no NullPointerException please)
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get node instance
+               $nodeInstance = Registry::getRegistry()->getInstance('node');
+
+               // Sanity-check on it
+               if (is_null($nodeInstance)) {
+                       // Throws a FilterChainException to stop further processing
+                       throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
+               } // END - if
+
+               // Shutdown the node. This should be the last line
+               $nodeInstance->doShutdown();
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/filter/shutdown/class_HubShutdownShutdownNodeFilter.php b/application/hub/main/filter/shutdown/class_HubShutdownShutdownNodeFilter.php
deleted file mode 100644 (file)
index 7c3af45..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/**
- * A ShutdownNode filter for shutting down the node. This filter should be the
- * last one in 'shutdown' chain so the hub is shutted down at the very end of
- * its life... R.I.P. little hub...
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class HubShutdownShutdownNodeFilter extends BaseFilter implements Filterable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this filter class
-        *
-        * @return      $filterInstance         An instance of this filter class
-        */
-       public final static function createHubShutdownShutdownNodeFilter () {
-               // Get a new instance
-               $filterInstance = new HubShutdownShutdownNodeFilter();
-
-               // Return the instance
-               return $filterInstance;
-       }
-
-       /**
-        * Executes the filter with given request and response objects
-        *
-        * @param       $requestInstance        An instance of a class with an Requestable interface
-        * @param       $responseInstance       An instance of a class with an Responseable interface
-        * @return      void
-        * @throws      FilterChainException    If $nodeInstance is null (no NullPointerException please)
-        */
-       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // Get node instance
-               $nodeInstance = Registry::getRegistry()->getInstance('node');
-
-               // Sanity-check on it
-               if (is_null($nodeInstance)) {
-                       // Throws a FilterChainException to stop further processing
-                       throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
-               } // END - if
-
-               // Shutdown the node. This should be the last line
-               $nodeInstance->doShutdown();
-       }
-}
-
-// [EOF]
-?>
index 0cb39a6e6cdcc41c0d5282bb792ad883b106e94f..4cd05978302f48d106d9c63ed939dc4720099daa 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class ???Listener extends BaseListener implements Listenable {
+class ???Listener extends BaseListener implements Listenable, Visitable {
        /**
         * Protected constructor
         *
index 40c91c5c86ad7d7a8ab79030d85afa740143d662..f06b7f25982acce827d1e8303d19be8d729e9cf3 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-class BaseListener extends BaseHubSystem {
+class BaseListener extends BaseHubSystem implements Visitable {
        // Exception code constants
        const EXCEPTION_INVALID_SOCKET = 0xa00;
 
index 912f313b391a4a0a7b4c082d13b642ea955797a4..fd0a3f2b102b69a143c16f8e1fe9b729b5f73e92 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class BaseListenerDecorator extends BaseHubSystem {
+class BaseListenerDecorator extends BaseHubSystem implements Visitable {
        /**
         * Protected constructor
         *
index 4e903bddcb6aef99247c93358f35145a5b042a1d..ea65be5b70590a6f3d4268a5b04881a5df39085a 100644 (file)
@@ -82,6 +82,25 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
                return $this->nodeId;
        }
 
+       /**
+        * Setter for listener pool instance
+        *
+        * @param       $listenerPoolInstance   Our new listener pool instance
+        * @return      void
+        */
+       private final function setListenerPoolInstance (PoolableListener $listenerPoolInstance) {
+               $this->listenerPoolInstance = $listenerPoolInstance;
+       }
+
+       /**
+        * Getter for listener pool instance
+        *
+        * @return      $listenerPoolInstance   Our current listener pool instance
+        */
+       public final function getListenerPoolInstance () {
+               return $this->listenerPoolInstance;
+       }
+
        /**
         * Setter for session id
         *
@@ -97,7 +116,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
         *
         * @return      $sessionId              Our new session id
         */
-       private final function getSessionId () {
+       public final function getSessionId () {
                return $this->sessionId;
        }
 
@@ -116,10 +135,19 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
         *
         * @return      $queryInstance          Our new query instance
         */
-       protected final function getQueryInstance () {
+       public final function getQueryInstance () {
                return $this->queryInstance;
        }
 
+       /**
+        * Getter for boot IP/port combination
+        *
+        * @return      $bootIpPort             The IP/port combination of the boot node
+        */
+       protected final function getBootIpPort () {
+               return $this->bootIpPort;
+       }
+
        /**
         * Checks wether the given IP address matches one of the bootstrapping nodes
         *
@@ -270,15 +298,6 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
                $this->debugOutput('BOOTSTRAP: Created new session-id: ' . $this->getSessionId() . '');
        }
 
-       /**
-        * Getter for boot IP/port combination
-        *
-        * @return      $bootIpPort             The IP/port combination of the boot node
-        */
-       protected final function getBootIpPort () {
-               return $this->bootIpPort;
-       }
-
        /**
         * Initializes queues which every node needs
         *
@@ -412,7 +431,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
                $this->debugOutput('HUB: Initialize listener: START');
 
                // Get a new pool instance
-               $this->listenerPoolInstance = ObjectFactory::createObjectByConfiguredName('listener_pool_class', array($this));
+               $this->setListenerPoolInstance(ObjectFactory::createObjectByConfiguredName('listener_pool_class', array($this)));
 
                // Get an instance of the low-level listener
                $listenerInstance = ObjectFactory::createObjectByConfiguredName('tcp_listener_class', array($this));
@@ -428,13 +447,13 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
                $decoratorInstance = ObjectFactory::createObjectByConfiguredName('hub_tcp_listener_class', array($listenerInstance));
 
                // Add this listener to the pool
-               $this->listenerPoolInstance->addListener($decoratorInstance);
+               $this->getListenerPoolInstance()->addListener($decoratorInstance);
 
                // Get a decorator class
                $decoratorInstance = ObjectFactory::createObjectByConfiguredName('client_tcp_listener_class', array($listenerInstance));
 
                // Add this listener to the pool
-               $this->listenerPoolInstance->addListener($decoratorInstance);
+               $this->getListenerPoolInstance()->addListener($decoratorInstance);
 
                // Get an instance of the low-level listener
                $listenerInstance = ObjectFactory::createObjectByConfiguredName('udp_listener_class', array($this));
@@ -450,13 +469,13 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
                $decoratorInstance = ObjectFactory::createObjectByConfiguredName('hub_udp_listener_class', array($listenerInstance));
 
                // Add this listener to the pool
-               $this->listenerPoolInstance->addListener($decoratorInstance);
+               $this->getListenerPoolInstance()->addListener($decoratorInstance);
 
                // Get a decorator class
                $decoratorInstance = ObjectFactory::createObjectByConfiguredName('client_udp_listener_class', array($listenerInstance));
 
                // Add this listener to the pool
-               $this->listenerPoolInstance->addListener($decoratorInstance);
+               $this->getListenerPoolInstance()->addListener($decoratorInstance);
 
                // Debug output
                $this->debugOutput('HUB: Initialize listener: FINISHED.');
index efa9aa9da21c325be497c96c860477499129fa51..b585fc2ca4a1b624669982563daedd15071abb33 100644 (file)
@@ -45,9 +45,8 @@ class BasePool extends BaseHubSystem {
         * @param       $poolSegment    Name of the pool segment
         * @param       $instance               An instance of a class we should add to the pool
         * @return      void
-        * @todo        Can we use Listenable instead of FrameworkInterface ?
         */
-       protected final function addInstance($group, $poolName, FrameworkInterface $instance) {
+       protected final function addInstance ($group, $poolName, Visitable $instance) {
                $this->poolEntries[$group][$poolName][] = $instance;
        }