From ab63d78f94f9ca8bef4eacdff7ca982be6ab39a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 19 May 2017 20:54:06 +0200 Subject: [PATCH] moved preShutdown() to BasePool and implemented Poolable there MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../hub/classes/pools/class_BasePool.php | 23 ++++++++++++++++++- .../listener/class_DefaultListenerPool.php | 21 ----------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/application/hub/classes/pools/class_BasePool.php b/application/hub/classes/pools/class_BasePool.php index d5666286f..afef4e8bf 100644 --- a/application/hub/classes/pools/class_BasePool.php +++ b/application/hub/classes/pools/class_BasePool.php @@ -5,6 +5,7 @@ namespace Hub\Pool; // Import hub-specific stuff use Hub\Generic\BaseHubSystem; use Hub\Helper\Connection\BaseConnectionHelper; +use Hub\Pool\Poolable; // Import framework stuff use CoreFramework\Factory\ObjectFactory; @@ -34,7 +35,7 @@ use CoreFramework\Visitor\Visitor; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class BasePool extends BaseHubSystem implements Visitable { +abstract class BasePool extends BaseHubSystem implements Poolable, Visitable { /** * Socket array elements */ @@ -197,4 +198,24 @@ class BasePool extends BaseHubSystem implements Visitable { // Return result return $isValid; } + + /** + * Run the pre-shutdown seqeuence by a visitor pattern + * + * @return void + */ + public function preShutdown () { + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down listener pool - CALLED!'); + + // Get a new visitor + $visitorInstance = ObjectFactory::createObjectByConfiguredName('shutdown_listener_pool_visitor_class'); + + // Start visiting + $this->accept($visitorInstance); + + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down listener pool - EXIT!'); + } + } diff --git a/application/hub/classes/pools/listener/class_DefaultListenerPool.php b/application/hub/classes/pools/listener/class_DefaultListenerPool.php index d7e2c56ed..55f16d29c 100644 --- a/application/hub/classes/pools/listener/class_DefaultListenerPool.php +++ b/application/hub/classes/pools/listener/class_DefaultListenerPool.php @@ -76,25 +76,4 @@ class DefaultListenerPool extends BasePool implements PoolableListener { ); } - /** - * Run the pre-shutdown seqeuence by a visitor pattern - * - * @return void - */ - public function preShutdown () { - // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down listener pool - CALLED!'); - - // Get a new visitor - $visitorInstance = ObjectFactory::createObjectByConfiguredName('shutdown_listener_pool_visitor_class'); - - // Start visiting - $this->accept($visitorInstance); - - // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down listener pool - EXIT!'); - } } - -// [EOF] -?> -- 2.39.5