From: Roland Häder Date: Fri, 19 May 2017 18:54:06 +0000 (+0200) Subject: moved preShutdown() to BasePool and implemented Poolable there X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ab63d78f94f9ca8bef4eacdff7ca982be6ab39a7;p=hub.git moved preShutdown() to BasePool and implemented Poolable there Signed-off-by: Roland Häder --- 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] -?>