From 9c40ceb2c5ccbddc67263658baf030c896a64743 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Tue, 11 Aug 2009 16:50:29 +0000
Subject: [PATCH] Interfaces added, shutdown filter added, deprecated methods
 removed

---
 .gitattributes                                |   8 ++
 application/hub/class_ApplicationHelper.php   |   4 -
 .../interfaces/pool/class_PoolableClient.php  |  36 ++++++
 .../pool/class_PoolableListener.php           |  35 +++++
 application/hub/main/class_BaseHubSystem.php  |   4 -
 .../class_HubBootstrapAquireHubIdFilter.php   |  76 +++++++++++
 .../class_HubBootstrapGenSessionIdFilter.php  |  74 +++++++++++
 .../pool/class_ShutdownPoolIterator.php       | 122 ++++++++++++++++++
 .../listener/class_BaseListenerDecorator.php  |   4 -
 application/hub/main/lists/class_BaseList.php |   4 -
 .../hub/main/visitor/class_BaseVisitor.php    |   4 -
 .../hub/main/visitor/shutdown/.htaccess       |   1 +
 .../hub/main/visitor/shutdown/class_Shutdown  |  50 +++++++
 .../class_ShutdownListenerPoolVisitor.php     |  67 ++++++++++
 14 files changed, 469 insertions(+), 20 deletions(-)
 create mode 100755 application/hub/interfaces/pool/class_PoolableClient.php
 create mode 100755 application/hub/interfaces/pool/class_PoolableListener.php
 create mode 100755 application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php
 create mode 100755 application/hub/main/filter/bootstrap/class_HubBootstrapGenSessionIdFilter.php
 create mode 100755 application/hub/main/iterator/pool/class_ShutdownPoolIterator.php
 create mode 100755 application/hub/main/visitor/shutdown/.htaccess
 create mode 100755 application/hub/main/visitor/shutdown/class_Shutdown
 create mode 100755 application/hub/main/visitor/shutdown/class_ShutdownListenerPoolVisitor.php

diff --git a/.gitattributes b/.gitattributes
index 338447b5d..a0c821e2c 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -28,6 +28,8 @@ application/hub/interfaces/nodes/.htaccess -text
 application/hub/interfaces/nodes/class_NodeHelper.php -text
 application/hub/interfaces/pool/.htaccess -text
 application/hub/interfaces/pool/class_Poolable.php -text
+application/hub/interfaces/pool/class_PoolableClient.php -text
+application/hub/interfaces/pool/class_PoolableListener.php -text
 application/hub/interfaces/pool/client/.htaccess -text
 application/hub/interfaces/pool/client/class_PoolableClient.php -text
 application/hub/interfaces/pool/listener/.htaccess -text
@@ -82,7 +84,9 @@ application/hub/main/filter/activation/.htaccess -text
 application/hub/main/filter/activation/class_HubActivation -text
 application/hub/main/filter/bootstrap/.htaccess -text
 application/hub/main/filter/bootstrap/class_HubBootstrap -text
+application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php -text
 application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php -text
+application/hub/main/filter/bootstrap/class_HubBootstrapGenSessionIdFilter.php -text
 application/hub/main/filter/bootstrap/class_HubBootstrapGenerateHubIdFilter.php -text
 application/hub/main/filter/bootstrap/class_HubBootstrapGenerateSessionIdFilter.php -text
 application/hub/main/filter/bootstrap/class_HubBootstrapInitQueuesFilter.php -text
@@ -117,6 +121,7 @@ application/hub/main/iterator/class_BaseIterator.php -text
 application/hub/main/iterator/network/.htaccess -text
 application/hub/main/iterator/network/class_NetworkListenIterator.php -text
 application/hub/main/iterator/pool/.htaccess -text
+application/hub/main/iterator/pool/class_ShutdownPoolIterator.php -text
 application/hub/main/iterator/pool/handler/.htaccess -text
 application/hub/main/iterator/pool/handler/class_Handler -text
 application/hub/main/iterator/pool/handler/class_HandlerPoolIterator.php -text
@@ -195,6 +200,9 @@ application/hub/main/visitor/pool/handler/class_HandlerListenerPoolVisitor.php -
 application/hub/main/visitor/pool/shutdown/.htaccess -text
 application/hub/main/visitor/pool/shutdown/class_Shutdown -text
 application/hub/main/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php -text
+application/hub/main/visitor/shutdown/.htaccess -text
+application/hub/main/visitor/shutdown/class_Shutdown -text
+application/hub/main/visitor/shutdown/class_ShutdownListenerPoolVisitor.php -text
 application/hub/starter.php -text
 /clear-cache.sh -text
 db/.htaccess -text
diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php
index b146c9744..49c4acab7 100644
--- a/application/hub/class_ApplicationHelper.php
+++ b/application/hub/class_ApplicationHelper.php
@@ -67,10 +67,6 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
 	protected function __construct () {
 		// Call parent constructor
 		parent::__construct(__CLASS__);
-
-		// Tidy up a little
-		$this->removeSystemArray();
-		$this->removeNumberFormaters();
 	}
 
 	/**
diff --git a/application/hub/interfaces/pool/class_PoolableClient.php b/application/hub/interfaces/pool/class_PoolableClient.php
new file mode 100755
index 000000000..c74c72f52
--- /dev/null
+++ b/application/hub/interfaces/pool/class_PoolableClient.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * A default client pool class
+ *
+ * @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 PoolableClient extends Poolable {
+	/**
+	 * Adds a socket resource to the client pool
+	 *
+	 * @param	$socketResource		A valid (must be!) socket resource
+	 * @return	void
+	 * @todo	0% done
+	 */
+	function addClient ($socketResource);
+}
+
+//
+?>
diff --git a/application/hub/interfaces/pool/class_PoolableListener.php b/application/hub/interfaces/pool/class_PoolableListener.php
new file mode 100755
index 000000000..162d8a6c7
--- /dev/null
+++ b/application/hub/interfaces/pool/class_PoolableListener.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * An interface for pools
+ *
+ * @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 PoolableListener extends Poolable {
+	/**
+	 * Adds a listener instance to this pool
+	 *
+	 * @param	$listenerInstance	An instance of a Listenable class
+	 * @return	void
+	 */
+	function addListener (Listenable $listenerInstance);
+}
+
+//
+?>
diff --git a/application/hub/main/class_BaseHubSystem.php b/application/hub/main/class_BaseHubSystem.php
index deee535e7..c741aad56 100644
--- a/application/hub/main/class_BaseHubSystem.php
+++ b/application/hub/main/class_BaseHubSystem.php
@@ -41,10 +41,6 @@ class BaseHubSystem extends BaseFrameworkSystem {
 	protected function __construct ($className) {
 		// Call parent constructor
 		parent::__construct($className);
-
-		// Clean up a little
-		$this->removeNumberFormaters();
-		$this->removeSystemArray();
 	}
 
 	/**
diff --git a/application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php b/application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php
new file mode 100755
index 000000000..8046882d7
--- /dev/null
+++ b/application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php
@@ -0,0 +1,76 @@
+<?php
+/**
+ * A ??? filter for bootstrapping
+ *
+ * @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 HubBootstrapAquireHubIdFilter 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 createHubBootstrapAquireHubIdFilter () {
+		// Get a new instance
+		$filterInstance = new HubBootstrapAquireHubIdFilter();
+
+		// 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)
+	 */
+	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
+
+		// --------------------- Hub-id acquirement phase ---------------------
+		// Acquire a hub-id. This step generates on first launch a new one and
+		// on any later launches it will restore the hub-id from the database.
+		// A passed 'nickname=xxx' argument will be used to add some
+		// 'personality' to the hub.
+		$nodeInstance->bootstrapAcquireHubId();
+	}
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/filter/bootstrap/class_HubBootstrapGenSessionIdFilter.php b/application/hub/main/filter/bootstrap/class_HubBootstrapGenSessionIdFilter.php
new file mode 100755
index 000000000..62a8040b4
--- /dev/null
+++ b/application/hub/main/filter/bootstrap/class_HubBootstrapGenSessionIdFilter.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * A GenSessionId filter for bootstrapping
+ *
+ * @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 HubBootstrapGenSessionIdFilter 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 createHubBootstrapGenSessionIdFilter () {
+		// Get a new instance
+		$filterInstance = new HubBootstrapGenSessionIdFilter();
+
+		// 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)
+	 */
+	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
+
+		// ------------------- More generic bootstrap steps -------------------
+		// Generate the session id which will only be stored in RAM and kept for
+		// the whole "session".
+		$nodeInstance->bootstrapGenerateSessionId();
+	}
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/iterator/pool/class_ShutdownPoolIterator.php b/application/hub/main/iterator/pool/class_ShutdownPoolIterator.php
new file mode 100755
index 000000000..1fbc0f190
--- /dev/null
+++ b/application/hub/main/iterator/pool/class_ShutdownPoolIterator.php
@@ -0,0 +1,122 @@
+<?php
+/**
+ * A ShutdownPool iterator
+ *
+ * @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/>.
+ */
+class ShutdownPoolIterator extends BaseIterator implements Iterator {
+	/**
+	 * Key for the global list index
+	 */
+	private $indexKey = 0;
+
+	/**
+	 * Protected constructor
+	 *
+	 * @return	void
+	 */
+	protected function __construct () {
+		// Call parent constructor
+		parent::__construct(__CLASS__);
+	}
+
+	/**
+	 * Creates an instance of this class
+	 *
+	 * @param	$listInstance		A list of a IteratorAggregate
+	 * @return	$iteratorInstance	An instance a Iterator class
+	 */
+	public final static function createShutdownPoolIterator (IteratorAggregate $listInstance) {
+		// Get new instance
+		$iteratorInstance = new ShutdownPoolIterator();
+
+		// Set the list
+		$iteratorInstance->setListInstance($listInstance);
+
+		// Return the prepared instance
+		return $iteratorInstance;
+	}
+
+	/**
+	 * Getter for current value from group or generic
+	 *
+	 * @return	$current	Current value in iteration
+	 * @throws	IndexOutOfBoundsException	If $indexKey is out of bounds
+	 */
+	public function current () {
+		// Default is null
+		$current = null;
+
+		// Is the entry valid?
+		if (!$this->valid()) {
+			// Throw an exception here
+			throw new IndexOutOfBoundsException($this->key(), self::EXCEPTION_INDEX_OUT_OF_BOUNDS);
+		} // END - if
+
+		// Now get the entry
+		$current = $this->getListInstance()->getEntry($this->key());
+
+		// Return it
+		return $current;
+	}
+
+	/**
+	 * Getter for key from group or generic
+	 *
+	 * @return	$indexKey	Current key in iteration
+	 */
+	public function key () {
+		return $this->indexKey;
+	}
+
+	/**
+	 * Advances to the next entry
+	 *
+	 * @return	void
+	 */
+	public function next () {
+		$this->indexKey++;
+	}
+
+	/**
+	 * Rewinds to the beginning of the iteration
+	 *
+	 * @return	void
+	 */
+	public function rewind () {
+		$this->indexKey = 0;
+	}
+
+	/**
+	 * Checks wether the current entry is valid (not at the end of the list)
+	 *
+	 * @return	$isValid	Wether the current entry is there
+	 */
+	public function valid () {
+		// Check for total active clients and if we are not at the end
+		$isValid = ($this->key() < $this->getListInstance()->count());
+
+		// Return result
+		return $isValid;
+	}
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/listener/class_BaseListenerDecorator.php b/application/hub/main/listener/class_BaseListenerDecorator.php
index 6db53684a..92c69431f 100644
--- a/application/hub/main/listener/class_BaseListenerDecorator.php
+++ b/application/hub/main/listener/class_BaseListenerDecorator.php
@@ -31,10 +31,6 @@ class BaseListenerDecorator extends BaseHubSystem implements Visitable {
 	protected function __construct ($className) {
 		// Call parent constructor
 		parent::__construct($className);
-
-		// Clean up a little
-		$this->removeNumberFormaters();
-		$this->removeSystemArray();
 	}
 
 	/**
diff --git a/application/hub/main/lists/class_BaseList.php b/application/hub/main/lists/class_BaseList.php
index 3403a63a1..99306aca6 100644
--- a/application/hub/main/lists/class_BaseList.php
+++ b/application/hub/main/lists/class_BaseList.php
@@ -51,10 +51,6 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
 	protected function __construct ($className) {
 		// Call parent constructor
 		parent::__construct($className);
-
-		// Remove some attributes
-		$this->removeNumberFormaters();
-		$this->removeSystemArray();
 	}
 
 	/**
diff --git a/application/hub/main/visitor/class_BaseVisitor.php b/application/hub/main/visitor/class_BaseVisitor.php
index c34ef9f2f..3c9050f96 100644
--- a/application/hub/main/visitor/class_BaseVisitor.php
+++ b/application/hub/main/visitor/class_BaseVisitor.php
@@ -36,10 +36,6 @@ class BaseVisitor extends BaseHubSystem {
 	protected function __construct ($className) {
 		// Call parent constructor
 		parent::__construct($className);
-
-		// Remove some attributes
-		$this->removeNumberFormaters();
-		$this->removeSystemArray();
 	}
 
 	/**
diff --git a/application/hub/main/visitor/shutdown/.htaccess b/application/hub/main/visitor/shutdown/.htaccess
new file mode 100755
index 000000000..3a4288278
--- /dev/null
+++ b/application/hub/main/visitor/shutdown/.htaccess
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/visitor/shutdown/class_Shutdown b/application/hub/main/visitor/shutdown/class_Shutdown
new file mode 100755
index 000000000..59511aa7b
--- /dev/null
+++ b/application/hub/main/visitor/shutdown/class_Shutdown
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A ??? shutdown visitor
+ *
+ * @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/>.
+ */
+class Shutdown???Visitor extends BaseVisitor implements PoolVisitor {
+	/**
+	 * Protected constructor
+	 *
+	 * @return	void
+	 */
+	protected function __construct () {
+		// Call parent constructor
+		parent::__construct(__CLASS__);
+	}
+
+	/**
+	 * Creates an instance of this class
+	 *
+	 * @return	$visitorInstance		An instance a Visitorable class
+	 */
+	public final static function createShutdown???Visitor () {
+		// Get new instance
+		$visitorInstance = new Shutdown???Visitor();
+
+		// Return the prepared instance
+		return $visitorInstance;
+	}
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/visitor/shutdown/class_ShutdownListenerPoolVisitor.php b/application/hub/main/visitor/shutdown/class_ShutdownListenerPoolVisitor.php
new file mode 100755
index 000000000..d4ca881d8
--- /dev/null
+++ b/application/hub/main/visitor/shutdown/class_ShutdownListenerPoolVisitor.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ * A ListenerPool shutdown visitor
+ *
+ * @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/>.
+ */
+class ShutdownListenerPoolVisitor extends BaseVisitor implements PoolVisitor {
+	/**
+	 * Protected constructor
+	 *
+	 * @return	void
+	 */
+	protected function __construct () {
+		// Call parent constructor
+		parent::__construct(__CLASS__);
+	}
+
+	/**
+	 * Creates an instance of this class
+	 *
+	 * @return	$visitorInstance		An instance a Visitorable class
+	 */
+	public final static function createShutdownListenerPoolVisitor () {
+		// Get new instance
+		$visitorInstance = new ShutdownListenerPoolVisitor();
+
+		// Return the prepared instance
+		return $visitorInstance;
+	}
+
+	/**
+	 * Visits the given pool instance
+	 *
+	 * @param	$poolInstance	A Poolable instance
+	 * @return	void
+	 */
+	public function visitPool (Poolable $poolInstance) {
+		// Debug message
+		$this->debugOutput('VISITOR: Visit of ' . $poolInstance->__toString() . ' - START');
+
+		// Pre-shutdown the pool
+		$poolInstance->preShutdown();
+
+		// Debug message
+		$this->debugOutput('VISITOR: Visit of ' . $poolInstance->__toString() . ' - FINISHED');
+	}
+}
+
+//
+?>
-- 
2.39.5