]> git.mxchange.org Git - hub.git/commitdiff
moved preShutdown() to BasePool and implemented Poolable there
authorRoland Häder <roland@mxchange.org>
Fri, 19 May 2017 18:54:06 +0000 (20:54 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 21 Aug 2020 16:50:02 +0000 (18:50 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
application/hub/classes/pools/class_BasePool.php
application/hub/classes/pools/listener/class_DefaultListenerPool.php

index d5666286f903e43512c9d8d4758d9cf74eb3d8a0..afef4e8bf715edb285cdd642d6163983e136cde9 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
  */
-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!');
+       }
+
 }
index d7e2c56ed5735c75b2ea7b153f52c73619ef202d..55f16d29cf40a6cd29f8b28c62de9db6bdcc2309 100644 (file)
@@ -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]
-?>