From: Roland Häder Date: Sat, 25 Feb 2023 12:47:36 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ebb8b87adb267a0cbc38372939914d03738d9dd7;p=hub.git Continued: - fixed handling of sockets in socket registry - also fixed key spaces for object registries - updated 'core' framework --- diff --git a/application/hub/classes/commands/console/class_HubConsoleAptProxyCommand.php b/application/hub/classes/commands/console/class_HubConsoleAptProxyCommand.php index 83254c90e..e55719a14 100644 --- a/application/hub/classes/commands/console/class_HubConsoleAptProxyCommand.php +++ b/application/hub/classes/commands/console/class_HubConsoleAptProxyCommand.php @@ -86,7 +86,7 @@ class HubConsoleAptProxyCommand extends BaseCommand implements Commandable { self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: Bootstrap finished.'); // Get apt-proxy instance - $proxyInstance = ObjectRegistry::getRegistry('hub')->getInstance('apt_proxy'); + $proxyInstance = ObjectRegistry::getRegistry('factory')->getInstance('apt_proxy'); // Add some apt-proxy-specific filters $proxyInstance->addExtraAptProxyFilters(); diff --git a/application/hub/classes/commands/console/class_HubConsoleChatCommand.php b/application/hub/classes/commands/console/class_HubConsoleChatCommand.php index 94db02e03..5901b612b 100644 --- a/application/hub/classes/commands/console/class_HubConsoleChatCommand.php +++ b/application/hub/classes/commands/console/class_HubConsoleChatCommand.php @@ -86,7 +86,7 @@ class HubConsoleChatCommand extends BaseCommand implements Commandable { self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: Bootstrap finished.'); // Get chat instance - $chatInstance = ObjectRegistry::getRegistry('hub')->getInstance('chat'); + $chatInstance = ObjectRegistry::getRegistry('factory')->getInstance('chat'); // Add some chat-specific filters $chatInstance->addExtraChatFilters(); diff --git a/application/hub/classes/commands/console/class_HubConsoleCrawlerCommand.php b/application/hub/classes/commands/console/class_HubConsoleCrawlerCommand.php index 911910a9f..f97620097 100644 --- a/application/hub/classes/commands/console/class_HubConsoleCrawlerCommand.php +++ b/application/hub/classes/commands/console/class_HubConsoleCrawlerCommand.php @@ -86,7 +86,7 @@ class HubConsoleCrawlerCommand extends BaseCommand implements Commandable { self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: Bootstrap finished.'); // Get crawler instance - $crawlerInstance = ObjectRegistry::getRegistry('hub')->getInstance('crawler'); + $crawlerInstance = ObjectRegistry::getRegistry('factory')->getInstance('crawler'); // Add some crawler-specific filters $crawlerInstance->addExtraCrawlerFilters(); diff --git a/application/hub/classes/commands/console/class_HubConsoleMinerCommand.php b/application/hub/classes/commands/console/class_HubConsoleMinerCommand.php index a286be8ce..90d3591eb 100644 --- a/application/hub/classes/commands/console/class_HubConsoleMinerCommand.php +++ b/application/hub/classes/commands/console/class_HubConsoleMinerCommand.php @@ -86,7 +86,7 @@ class HubConsoleMinerCommand extends BaseCommand implements Commandable { self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: Bootstrap finished.'); // Get miner instance - $minerInstance = ObjectRegistry::getRegistry('hub')->getInstance('miner'); + $minerInstance = ObjectRegistry::getRegistry('factory')->getInstance('miner'); // Add some miner-specific filters $minerInstance->addExtraMinerFilters(); diff --git a/application/hub/classes/crawler/class_BaseNodeCrawler.php b/application/hub/classes/crawler/class_BaseNodeCrawler.php index fc887d097..221cedba0 100644 --- a/application/hub/classes/crawler/class_BaseNodeCrawler.php +++ b/application/hub/classes/crawler/class_BaseNodeCrawler.php @@ -54,7 +54,7 @@ abstract class BaseNodeCrawler extends BaseHubSystem { parent::__construct($className); // Set this crawler instance in registry - ObjectRegistry::getRegistry('hub')->addInstance('crawler', $this); + ObjectRegistry::getRegistry('factory')->addInstance('crawler', $this); // Init state which sets the state to 'init' $this->initState(); diff --git a/application/hub/classes/factories/node/class_NodeObjectFactory.php b/application/hub/classes/factories/node/class_NodeObjectFactory.php index c92ec5fb9..7e0cb377f 100644 --- a/application/hub/classes/factories/node/class_NodeObjectFactory.php +++ b/application/hub/classes/factories/node/class_NodeObjectFactory.php @@ -58,26 +58,26 @@ class NodeObjectFactory extends BaseFactory { */ public static final function createNodeInstance (Requestable $requestInstance = NULL, Responseable $responseInstance = NULL) { // Get new factory instance - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: requestInstance[]=%s,responseInstance[]=%s - CALLED!', gettype($requestInstance), gettype($responseInstance))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: requestInstance[]=%s,responseInstance[]=%s - CALLED!', gettype($requestInstance), gettype($responseInstance))); $factoryInstance = new NodeObjectFactory(); // If there is no handler? if (ObjectRegistry::getRegistry('factory')->instanceExists('node')) { // Get handler from registry - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-FACTORY: Getting node instance from registry ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-FACTORY: Getting node instance from registry ...'); $nodeInstance = ObjectRegistry::getRegistry('factory')->getInstance('node'); } elseif (($requestInstance instanceof Requestable) && ($responseInstance instanceof Responseable)) { // The default node-mode is from our configuration - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-FACTORY: requestInstance and responseInstance are both set.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-FACTORY: requestInstance and responseInstance are both set.'); $nodeMode = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('node_default_mode'); // Is the node 'mode' parameter set? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: nodeMode=%s - from CONFIG', $nodeMode)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: nodeMode=%s - from CONFIG', $nodeMode)); if ($requestInstance->isRequestElementSet('mode')) { // Then use this which overrides the config entry temporarily $nodeMode = $requestInstance->getRequestElement('mode'); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: nodeMode=%s - from REQUEST', $nodeMode)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: nodeMode=%s - from REQUEST', $nodeMode)); } else { // Set it for easier re-usage $requestInstance->setRequestElement('mode', $nodeMode); @@ -91,18 +91,18 @@ class NodeObjectFactory extends BaseFactory { ); // Get the node instance - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: Loading class with className=%s ...', $className)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: Loading class with className=%s ...', $className)); $nodeInstance = ObjectFactory::createObjectByName($className); // Get a registry $applicationInstance = ApplicationHelper::getSelfInstance(); // Add node-specific filters - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: Registering node-specific filters, responseInstance[]=%s', gettype($responseInstance))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: Registering node-specific filters, responseInstance[]=%s', gettype($responseInstance))); $nodeInstance->addExtraFilters($applicationInstance->getControllerInstance(), $responseInstance); // Add it to the registry - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: Adding nodeInstance=%s to registry ...', $nodeInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: Adding nodeInstance=%s to registry ...', $nodeInstance->__toString())); ObjectRegistry::getRegistry('factory')->addInstance('node', $nodeInstance); } else { // Throw an exception here @@ -110,7 +110,7 @@ class NodeObjectFactory extends BaseFactory { } // Return the instance - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: nodeInstance=%s - EXIT!', $nodeInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: nodeInstance=%s - EXIT!', $nodeInstance->__toString())); return $nodeInstance; } diff --git a/application/hub/classes/factories/socket/class_SocketFactory.php b/application/hub/classes/factories/socket/class_SocketFactory.php index cafb1e9e0..3863ff4af 100644 --- a/application/hub/classes/factories/socket/class_SocketFactory.php +++ b/application/hub/classes/factories/socket/class_SocketFactory.php @@ -337,10 +337,8 @@ class SocketFactory extends BaseFactory { * @throws InvalidSocketException Thrown if the socket could not be initialized */ public static function createListenUdpSocket (Listenable $listenerInstance) { - // Trace message - //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: listenerInstance=%s - CALLED!', $listenerInstance->__toString())); - // Create a streaming socket, of type UDP + //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: listenerInstance=%s - CALLED!', $listenerInstance->__toString())); $socketResource = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); // Init fake package instance @@ -394,10 +392,8 @@ class SocketFactory extends BaseFactory { $socketInstance->handleSocketError(__METHOD__, __LINE__); } - // Trace message - //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: socketInstance=%s - EXIT!', $socketInstance->__toString())); - // Return prepepared socket + //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: socketInstance=%s - EXIT!', $socketInstance->__toString())); return $socketInstance; } @@ -412,10 +408,8 @@ class SocketFactory extends BaseFactory { * @throws LogicException If the current instance is not valid */ public static final function createNextAcceptedSocketFromPool (Poolable $poolInstance, StorableSocket $socketInstance) { - // Trace message - //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: poolInstance=%s,socketInstance->socketResource=%s - CALLED!', $poolInstance->__toString(), $socketInstance->getSocketResource())); - // Get socket protocol + //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-FACTORY: poolInstance=%s,socketInstance->socketResource=%s - CALLED!', $poolInstance->__toString(), $socketInstance->getSocketResource())); $socketProtocol = $socketInstance->getSocketProtocol(); // Is the an iterator instance? @@ -458,7 +452,7 @@ class SocketFactory extends BaseFactory { $acceptedSocketInstance = $current[Poolable::SOCKET_ARRAY_INSTANCE]->acceptNewIncomingSocket(); // Return found socket instance - //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: acceptedSocketInstance[]=%s - EXIT!', gettype($acceptedSocketInstance))); + //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-FACTORY: acceptedSocketInstance[]=%s - EXIT!', gettype($acceptedSocketInstance))); return $acceptedSocketInstance; } @@ -472,7 +466,7 @@ class SocketFactory extends BaseFactory { */ public static final function createIncomingSocketInstance ($socketResource, string $socketProtocol) { // Validate parameter - /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: socketResource[%s]=%s,socketProtocol=%s - CALLED!', gettype($socketResource), $socketResource, $socketProtocol)); + /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-FACTORY: socketResource[%s]=%s,socketProtocol=%s - CALLED!', gettype($socketResource), $socketResource, $socketProtocol)); if (!is_resource($socketResource)) { // Throw exception throw new InvalidArgumentException(sprintf('socketResource[]=%s is not valid', gettype($socketResource))); @@ -527,7 +521,7 @@ class SocketFactory extends BaseFactory { } // Return found socket instance - /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: socketInstance=%s - EXIT!', $socketInstance->__toString())); + /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-FACTORY: socketInstance=%s - EXIT!', $socketInstance->__toString())); return $socketInstance; } } diff --git a/application/hub/classes/factories/source/url/class_UrlSourceObjectFactory.php b/application/hub/classes/factories/source/url/class_UrlSourceObjectFactory.php index c3c136bb2..48c017a35 100644 --- a/application/hub/classes/factories/source/url/class_UrlSourceObjectFactory.php +++ b/application/hub/classes/factories/source/url/class_UrlSourceObjectFactory.php @@ -52,7 +52,7 @@ class UrlSourceObjectFactory extends BaseFactory { $factoryInstance = new UrlSourceObjectFactory(); // Get task handler instance - $handlerInstance = ObjectRegistry::getRegistry('factory')->getInstance('task_handler'); + $handlerInstance = ObjectRegistry::getRegistry('generic')->getInstance('task_handler'); // Get source type by looking for given task instance in task handler $sourceType = $handlerInstance->searchTask($taskInstance); diff --git a/application/hub/classes/filter/apt-proxy/class_AptProxyInitializationFilter.php b/application/hub/classes/filter/apt-proxy/class_AptProxyInitializationFilter.php index af7c0f8ed..5db7f861c 100644 --- a/application/hub/classes/filter/apt-proxy/class_AptProxyInitializationFilter.php +++ b/application/hub/classes/filter/apt-proxy/class_AptProxyInitializationFilter.php @@ -78,7 +78,7 @@ class AptProxyInitializationFilter extends BaseAptProxyFilter implements Filtera $proxyInstance->addExtraFilters($applicationInstance->getControllerInstance(), $responseInstance); // Set the apt_proxy instance in registry - ObjectRegistry::getRegistry('hub')->addInstance('apt_proxy', $proxyInstance); + ObjectRegistry::getRegistry('factory')->addInstance('apt_proxy', $proxyInstance); } } diff --git a/application/hub/classes/filter/apt-proxy/class_AptProxyWelcomeTeaserFilter.php b/application/hub/classes/filter/apt-proxy/class_AptProxyWelcomeTeaserFilter.php index e3af90ce9..f2f9a5b10 100644 --- a/application/hub/classes/filter/apt-proxy/class_AptProxyWelcomeTeaserFilter.php +++ b/application/hub/classes/filter/apt-proxy/class_AptProxyWelcomeTeaserFilter.php @@ -68,7 +68,7 @@ class AptProxyWelcomeTeaserFilter extends BaseAptProxyFilter implements Filterab */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get node instance - $proxyInstance = ObjectRegistry::getRegistry('hub')->getInstance('apt_proxy'); + $proxyInstance = ObjectRegistry::getRegistry('factory')->getInstance('apt_proxy'); // Now output the teaser $proxyInstance->outputConsoleTeaser(); diff --git a/application/hub/classes/filter/bootstrap/apt-proxy/class_AptProxyBootstrap b/application/hub/classes/filter/bootstrap/apt-proxy/class_AptProxyBootstrap index f8388a394..592cc6267 100644 --- a/application/hub/classes/filter/bootstrap/apt-proxy/class_AptProxyBootstrap +++ b/application/hub/classes/filter/bootstrap/apt-proxy/class_AptProxyBootstrap @@ -65,7 +65,7 @@ class AptProxyBootstrap???Filter extends BaseAptProxyFilter implements Filterabl */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get apt-proxy instance - $proxyInstance = ObjectRegistry::getRegistry('hub')->getInstance('apt_proxy'); + $proxyInstance = ObjectRegistry::getRegistry('factory')->getInstance('apt_proxy'); // Now do something DebugMiddleware::getSelfInstance()->partialStub('Please implement this step.'); diff --git a/application/hub/classes/filter/bootstrap/apt-proxy/class_AptProxyBootstrapExtraBootstrappingFilter.php b/application/hub/classes/filter/bootstrap/apt-proxy/class_AptProxyBootstrapExtraBootstrappingFilter.php index aab49d44f..9658479f1 100644 --- a/application/hub/classes/filter/bootstrap/apt-proxy/class_AptProxyBootstrapExtraBootstrappingFilter.php +++ b/application/hub/classes/filter/bootstrap/apt-proxy/class_AptProxyBootstrapExtraBootstrappingFilter.php @@ -67,7 +67,7 @@ class AptProxyBootstrapExtraBootstrappingFilter extends BaseAptProxyFilter imple */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get apt-proxy instance - $proxyInstance = ObjectRegistry::getRegistry('hub')->getInstance('apt_proxy'); + $proxyInstance = ObjectRegistry::getRegistry('factory')->getInstance('apt_proxy'); // Do some extra bootstrapping steps $proxyInstance->doBootstrapping(); diff --git a/application/hub/classes/filter/bootstrap/apt-proxy/class_AptProxyBootstrapGenericActivationFilter.php b/application/hub/classes/filter/bootstrap/apt-proxy/class_AptProxyBootstrapGenericActivationFilter.php index 46fedc320..e075e9494 100644 --- a/application/hub/classes/filter/bootstrap/apt-proxy/class_AptProxyBootstrapGenericActivationFilter.php +++ b/application/hub/classes/filter/bootstrap/apt-proxy/class_AptProxyBootstrapGenericActivationFilter.php @@ -67,7 +67,7 @@ class AptProxyBootstrapGenericActivationFilter extends BaseAptProxyFilter implem */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get a apt-proxy instance - $proxyInstance = ObjectRegistry::getRegistry('hub')->getInstance('apt_proxy'); + $proxyInstance = ObjectRegistry::getRegistry('factory')->getInstance('apt_proxy'); // Set the flag $proxyInstance->enableIsActive(); diff --git a/application/hub/classes/filter/bootstrap/chat/class_ChatBootstrap b/application/hub/classes/filter/bootstrap/chat/class_ChatBootstrap index a0a2161f6..caf94d406 100644 --- a/application/hub/classes/filter/bootstrap/chat/class_ChatBootstrap +++ b/application/hub/classes/filter/bootstrap/chat/class_ChatBootstrap @@ -65,7 +65,7 @@ class ChatBootstrap???Filter extends BaseChatFilter implements Filterable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get chat instance - $chatInstance = ObjectRegistry::getRegistry('hub')->getInstance('chat'); + $chatInstance = ObjectRegistry::getRegistry('factory')->getInstance('chat'); // Now do something DebugMiddleware::getSelfInstance()->partialStub('Please implement this step.'); diff --git a/application/hub/classes/filter/bootstrap/chat/class_ChatBootstrapExtraBootstrappingFilter.php b/application/hub/classes/filter/bootstrap/chat/class_ChatBootstrapExtraBootstrappingFilter.php index 5da5bd443..0d3cf7c1c 100644 --- a/application/hub/classes/filter/bootstrap/chat/class_ChatBootstrapExtraBootstrappingFilter.php +++ b/application/hub/classes/filter/bootstrap/chat/class_ChatBootstrapExtraBootstrappingFilter.php @@ -67,7 +67,7 @@ class ChatBootstrapExtraBootstrappingFilter extends BaseChatFilter implements Fi */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get chat instance - $chatInstance = ObjectRegistry::getRegistry('hub')->getInstance('chat'); + $chatInstance = ObjectRegistry::getRegistry('factory')->getInstance('chat'); // Do some extra bootstrapping steps $chatInstance->doBootstrapping(); diff --git a/application/hub/classes/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php b/application/hub/classes/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php index d845a3bd1..21be0588b 100644 --- a/application/hub/classes/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php +++ b/application/hub/classes/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php @@ -67,7 +67,7 @@ class ChatBootstrapGenericActivationFilter extends BaseChatFilter implements Fil */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get a chat instance - $chatInstance = ObjectRegistry::getRegistry('hub')->getInstance('chat'); + $chatInstance = ObjectRegistry::getRegistry('factory')->getInstance('chat'); // Set the flag $chatInstance->enableIsActive(); diff --git a/application/hub/classes/filter/bootstrap/crawler/class_CrawlerBootstrap b/application/hub/classes/filter/bootstrap/crawler/class_CrawlerBootstrap index e47057004..eaf906032 100644 --- a/application/hub/classes/filter/bootstrap/crawler/class_CrawlerBootstrap +++ b/application/hub/classes/filter/bootstrap/crawler/class_CrawlerBootstrap @@ -65,7 +65,7 @@ class CrawlerBootstrap???Filter extends BaseCrawlerFilter implements Filterable */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get crawler instance - $crawlerInstance = ObjectRegistry::getRegistry('hub')->getInstance('crawler'); + $crawlerInstance = ObjectRegistry::getRegistry('factory')->getInstance('crawler'); // Now do something DebugMiddleware::getSelfInstance()->partialStub('Please implement this step.'); diff --git a/application/hub/classes/filter/bootstrap/crawler/class_CrawlerBootstrapExtraBootstrappingFilter.php b/application/hub/classes/filter/bootstrap/crawler/class_CrawlerBootstrapExtraBootstrappingFilter.php index 4aec418be..5a82fa2f9 100644 --- a/application/hub/classes/filter/bootstrap/crawler/class_CrawlerBootstrapExtraBootstrappingFilter.php +++ b/application/hub/classes/filter/bootstrap/crawler/class_CrawlerBootstrapExtraBootstrappingFilter.php @@ -67,7 +67,7 @@ class CrawlerBootstrapExtraBootstrappingFilter extends BaseCrawlerFilter impleme */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get crawler instance - $crawlerInstance = ObjectRegistry::getRegistry('hub')->getInstance('crawler'); + $crawlerInstance = ObjectRegistry::getRegistry('factory')->getInstance('crawler'); // Do some extra bootstrapping steps $crawlerInstance->doBootstrapping(); diff --git a/application/hub/classes/filter/bootstrap/crawler/class_CrawlerBootstrapGenericActivationFilter.php b/application/hub/classes/filter/bootstrap/crawler/class_CrawlerBootstrapGenericActivationFilter.php index daef9b109..93116a976 100644 --- a/application/hub/classes/filter/bootstrap/crawler/class_CrawlerBootstrapGenericActivationFilter.php +++ b/application/hub/classes/filter/bootstrap/crawler/class_CrawlerBootstrapGenericActivationFilter.php @@ -67,7 +67,7 @@ class CrawlerBootstrapGenericActivationFilter extends BaseCrawlerFilter implemen */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get a crawler instance - $crawlerInstance = ObjectRegistry::getRegistry('hub')->getInstance('crawler'); + $crawlerInstance = ObjectRegistry::getRegistry('factory')->getInstance('crawler'); // Set the flag $crawlerInstance->enableIsActive(); diff --git a/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrap b/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrap index 800f2a1e4..7666961b7 100644 --- a/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrap +++ b/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrap @@ -68,7 +68,7 @@ class MinerBootstrap???Filter extends BaseMinerFilter implements Filterable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get miner instance - $minerInstance = ObjectRegistry::getRegistry('hub')->getInstance('miner'); + $minerInstance = ObjectRegistry::getRegistry('factory')->getInstance('miner'); // Now do something DebugMiddleware::getSelfInstance()->partialStub('Please implement this step.'); diff --git a/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrapBufferQueueInitializerFilter.php b/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrapBufferQueueInitializerFilter.php index e2424e9a7..da5a50745 100644 --- a/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrapBufferQueueInitializerFilter.php +++ b/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrapBufferQueueInitializerFilter.php @@ -67,7 +67,7 @@ class MinerBootstrapBufferQueueInitializerFilter extends BaseMinerFilter impleme */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get miner instance - $minerInstance = ObjectRegistry::getRegistry('hub')->getInstance('miner'); + $minerInstance = ObjectRegistry::getRegistry('factory')->getInstance('miner'); // Init all buffer queues $minerInstance->initBufferQueues(); diff --git a/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrapExtraBootstrappingFilter.php b/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrapExtraBootstrappingFilter.php index 599f534fa..91409fba2 100644 --- a/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrapExtraBootstrappingFilter.php +++ b/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrapExtraBootstrappingFilter.php @@ -67,7 +67,7 @@ class MinerBootstrapExtraBootstrappingFilter extends BaseMinerFilter implements */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get miner instance - $minerInstance = ObjectRegistry::getRegistry('hub')->getInstance('miner'); + $minerInstance = ObjectRegistry::getRegistry('factory')->getInstance('miner'); // Do some extra bootstrapping steps $minerInstance->doBootstrapping(); diff --git a/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrapGenericActivationFilter.php b/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrapGenericActivationFilter.php index ac78b7742..5880ec70a 100644 --- a/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrapGenericActivationFilter.php +++ b/application/hub/classes/filter/bootstrap/miner/class_MinerBootstrapGenericActivationFilter.php @@ -67,7 +67,7 @@ class MinerBootstrapGenericActivationFilter extends BaseMinerFilter implements F */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get a miner instance - $minerInstance = ObjectRegistry::getRegistry('hub')->getInstance('miner'); + $minerInstance = ObjectRegistry::getRegistry('factory')->getInstance('miner'); // Set the flag $minerInstance->enableIsActive(); diff --git a/application/hub/classes/filter/chat/class_ChatInitializationFilter.php b/application/hub/classes/filter/chat/class_ChatInitializationFilter.php index 6f03a23ce..cfc331bfc 100644 --- a/application/hub/classes/filter/chat/class_ChatInitializationFilter.php +++ b/application/hub/classes/filter/chat/class_ChatInitializationFilter.php @@ -78,7 +78,7 @@ class ChatInitializationFilter extends BaseChatFilter implements Filterable { $chatInstance->addExtraFilters($applicationInstance->getControllerInstance(), $responseInstance); // Set the chat instance in registry - ObjectRegistry::getRegistry('hub')->addInstance('chat', $chatInstance); + ObjectRegistry::getRegistry('factory')->addInstance('chat', $chatInstance); } } diff --git a/application/hub/classes/filter/chat/class_ChatWelcomeTeaserFilter.php b/application/hub/classes/filter/chat/class_ChatWelcomeTeaserFilter.php index 27e8bf917..834c1212f 100644 --- a/application/hub/classes/filter/chat/class_ChatWelcomeTeaserFilter.php +++ b/application/hub/classes/filter/chat/class_ChatWelcomeTeaserFilter.php @@ -68,7 +68,7 @@ class ChatWelcomeTeaserFilter extends BaseChatFilter implements Filterable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get node instance - $chatInstance = ObjectRegistry::getRegistry('hub')->getInstance('chat'); + $chatInstance = ObjectRegistry::getRegistry('factory')->getInstance('chat'); // Now output the teaser $chatInstance->outputConsoleTeaser(); diff --git a/application/hub/classes/filter/crawler/class_CrawlerWelcomeTeaserFilter.php b/application/hub/classes/filter/crawler/class_CrawlerWelcomeTeaserFilter.php index 59bec3866..e28d56e10 100644 --- a/application/hub/classes/filter/crawler/class_CrawlerWelcomeTeaserFilter.php +++ b/application/hub/classes/filter/crawler/class_CrawlerWelcomeTeaserFilter.php @@ -68,7 +68,7 @@ class CrawlerWelcomeTeaserFilter extends BaseCrawlerFilter implements Filterable */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get node instance - $crawlerInstance = ObjectRegistry::getRegistry('hub')->getInstance('crawler'); + $crawlerInstance = ObjectRegistry::getRegistry('factory')->getInstance('crawler'); // Now output the teaser $crawlerInstance->outputConsoleTeaser(); diff --git a/application/hub/classes/filter/miner/class_MinerWelcomeTeaserFilter.php b/application/hub/classes/filter/miner/class_MinerWelcomeTeaserFilter.php index 54b3c6bdf..0d5359682 100644 --- a/application/hub/classes/filter/miner/class_MinerWelcomeTeaserFilter.php +++ b/application/hub/classes/filter/miner/class_MinerWelcomeTeaserFilter.php @@ -68,7 +68,7 @@ class MinerWelcomeTeaserFilter extends BaseMinerFilter implements Filterable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get node instance - $minerInstance = ObjectRegistry::getRegistry('hub')->getInstance('miner'); + $minerInstance = ObjectRegistry::getRegistry('factory')->getInstance('miner'); // Now output the teaser $minerInstance->outputConsoleTeaser(); diff --git a/application/hub/classes/filter/shutdown/apt-proxy/class_AptProxyShutdownFilter.php b/application/hub/classes/filter/shutdown/apt-proxy/class_AptProxyShutdownFilter.php index c4f0da349..092548b7f 100644 --- a/application/hub/classes/filter/shutdown/apt-proxy/class_AptProxyShutdownFilter.php +++ b/application/hub/classes/filter/shutdown/apt-proxy/class_AptProxyShutdownFilter.php @@ -69,7 +69,7 @@ class AptProxyShutdownFilter extends BaseAptProxyFilter implements Filterable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get node instance - $proxyInstance = ObjectRegistry::getRegistry('hub')->getInstance('apt_proxy'); + $proxyInstance = ObjectRegistry::getRegistry('factory')->getInstance('apt_proxy'); // Shutdown the apt-proxy. This should be the last line $proxyInstance->doShutdown(); diff --git a/application/hub/classes/filter/shutdown/chat/class_ChatShutdownFilter.php b/application/hub/classes/filter/shutdown/chat/class_ChatShutdownFilter.php index 2b8587f07..69e2fa47c 100644 --- a/application/hub/classes/filter/shutdown/chat/class_ChatShutdownFilter.php +++ b/application/hub/classes/filter/shutdown/chat/class_ChatShutdownFilter.php @@ -69,7 +69,7 @@ class ChatShutdownFilter extends BaseChatFilter implements Filterable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get node instance - $chatInstance = ObjectRegistry::getRegistry('hub')->getInstance('chat'); + $chatInstance = ObjectRegistry::getRegistry('factory')->getInstance('chat'); // Shutdown the chat. This should be the last line $chatInstance->doShutdown(); diff --git a/application/hub/classes/filter/shutdown/crawler/class_CrawlerShutdownFilter.php b/application/hub/classes/filter/shutdown/crawler/class_CrawlerShutdownFilter.php index cee9f5ab4..9cc8a01a8 100644 --- a/application/hub/classes/filter/shutdown/crawler/class_CrawlerShutdownFilter.php +++ b/application/hub/classes/filter/shutdown/crawler/class_CrawlerShutdownFilter.php @@ -69,7 +69,7 @@ class CrawlerShutdownFilter extends BaseCrawlerFilter implements Filterable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get node instance - $crawlerInstance = ObjectRegistry::getRegistry('hub')->getInstance('crawler'); + $crawlerInstance = ObjectRegistry::getRegistry('factory')->getInstance('crawler'); // Shutdown the crawler. This should be the last line $crawlerInstance->doShutdown(); diff --git a/application/hub/classes/filter/shutdown/miner/class_MinerShutdownFilter.php b/application/hub/classes/filter/shutdown/miner/class_MinerShutdownFilter.php index 483f37e04..777cf448a 100644 --- a/application/hub/classes/filter/shutdown/miner/class_MinerShutdownFilter.php +++ b/application/hub/classes/filter/shutdown/miner/class_MinerShutdownFilter.php @@ -69,7 +69,7 @@ class MinerShutdownFilter extends BaseMinerFilter implements Filterable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get node instance - $minerInstance = ObjectRegistry::getRegistry('hub')->getInstance('miner'); + $minerInstance = ObjectRegistry::getRegistry('factory')->getInstance('miner'); // Shutdown the miner. This should be the last line $minerInstance->doShutdown(); diff --git a/application/hub/classes/filter/task/apt-proxy/class_AptProxyTaskHandlerInitializerFilter.php b/application/hub/classes/filter/task/apt-proxy/class_AptProxyTaskHandlerInitializerFilter.php index 3963a731d..286d0bd15 100644 --- a/application/hub/classes/filter/task/apt-proxy/class_AptProxyTaskHandlerInitializerFilter.php +++ b/application/hub/classes/filter/task/apt-proxy/class_AptProxyTaskHandlerInitializerFilter.php @@ -69,7 +69,7 @@ class AptProxyTaskHandlerInitializerFilter extends BaseAptProxyFilter implements */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get apt-proxy instance - //$chatInstance = ObjectRegistry::getRegistry('hub')->getInstance('chat'); + //$chatInstance = ObjectRegistry::getRegistry('factory')->getInstance('chat'); // Get a new task handler instance $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); diff --git a/application/hub/classes/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php b/application/hub/classes/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php index 35ec83c67..984ece317 100644 --- a/application/hub/classes/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php +++ b/application/hub/classes/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php @@ -69,7 +69,7 @@ class ChatTaskHandlerInitializerFilter extends BaseChatFilter implements Filtera */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get chat instance - //$chatInstance = ObjectRegistry::getRegistry('hub')->getInstance('chat'); + //$chatInstance = ObjectRegistry::getRegistry('factory')->getInstance('chat'); // Get a new task handler instance $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); diff --git a/application/hub/classes/filter/task/class_BaseCrawlerTaskFilter.php b/application/hub/classes/filter/task/class_BaseCrawlerTaskFilter.php index 989e231b0..538823da7 100644 --- a/application/hub/classes/filter/task/class_BaseCrawlerTaskFilter.php +++ b/application/hub/classes/filter/task/class_BaseCrawlerTaskFilter.php @@ -79,7 +79,7 @@ abstract class BaseCrawlerTaskFilter extends BaseCrawlerFilter { $handlerInstance->registerTask('crawler_snippet_extractor', $taskInstance); // Add handler instance to registry - ObjectRegistry::getRegistry('hub')->addInstance('task_handler', $handlerInstance); + ObjectRegistry::getRegistry('generic')->addInstance('task_handler', $handlerInstance); } } diff --git a/application/hub/classes/filter/task/miner/class_MinerTaskHandlerInitializerFilter.php b/application/hub/classes/filter/task/miner/class_MinerTaskHandlerInitializerFilter.php index 204c33220..0c3920a0a 100644 --- a/application/hub/classes/filter/task/miner/class_MinerTaskHandlerInitializerFilter.php +++ b/application/hub/classes/filter/task/miner/class_MinerTaskHandlerInitializerFilter.php @@ -69,7 +69,7 @@ class MinerTaskHandlerInitializerFilter extends BaseMinerFilter implements Filte */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get miner instance - //$minerInstance = ObjectRegistry::getRegistry('hub')->getInstance('miner'); + //$minerInstance = ObjectRegistry::getRegistry('factory')->getInstance('miner'); // Get a new task handler instance $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); diff --git a/application/hub/classes/listener/class_BaseListener.php b/application/hub/classes/listener/class_BaseListener.php index 689bc3837..a1136abeb 100644 --- a/application/hub/classes/listener/class_BaseListener.php +++ b/application/hub/classes/listener/class_BaseListener.php @@ -114,11 +114,11 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { */ private function handleIncomingSocket (StorableSocket $socketInstance) { // Handle it here, if not main server socket - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance=%s - CALLED!', strtoupper($this->getProtocolName()), $socketInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: socketInstance=%s - CALLED!', strtoupper($this->getProtocolName()), $socketInstance->__toString())); $this->getHandlerInstance()->processRawDataFromSocketInstance($socketInstance); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); } /** @@ -229,7 +229,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { */ protected function registerServerSocketInstance (StorableSocket $socketInstance) { // First check if it is valid - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance=%s - CALLED!', strtoupper($this->getProtocolName()), $socketInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: socketInstance=%s - CALLED!', strtoupper($this->getProtocolName()), $socketInstance->__toString())); if ($this->isServerSocketRegistered($socketInstance)) { // Already registered throw new SocketAlreadyRegisteredException(array($this, $socketInstance->getSocketResource()), self::EXCEPTION_SOCKET_ALREADY_REGISTERED); @@ -248,15 +248,15 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { $infoInstance->fillWithListenerInformation($this); // Register the socket - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: Registering socketInstance->socketResource=%s,socketType=%s ...', strtoupper($this->getProtocolName()), $socketInstance->getSocketResource(), $socketInstance->getSocketType())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: Registering socketInstance->socketResource=%s,socketType=%s ...', strtoupper($this->getProtocolName()), $socketInstance->getSocketResource(), $socketInstance->getSocketType())); $this->getRegistryInstance()->registerSocketInstance($infoInstance, $socketInstance); // And set it here - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: Setting socketInstance=%s (socketResource=%s) ...', strtoupper($this->getProtocolName()), $socketInstance->__toString(), $socketInstance->getSocketResource())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: Setting socketInstance=%s (socketResource=%s) ...', strtoupper($this->getProtocolName()), $socketInstance->__toString(), $socketInstance->getSocketResource())); $this->setSocketInstance($socketInstance); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); } /** @@ -268,11 +268,11 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { */ protected function isServerSocketRegistered (StorableSocket $socketInstance) { // Get a connection info instance - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance=%s - CALLED!', strtoupper($this->getProtocolName()), $socketInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: socketInstance=%s - CALLED!', strtoupper($this->getProtocolName()), $socketInstance->__toString())); $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($this->getProtocolName(), StorableSocket::CONNECTION_TYPE_SERVER); // Is the instance set? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: infoInstance[]=%s', strtoupper($this->getProtocolName()), gettype($infoInstance))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: infoInstance[]=%s', strtoupper($this->getProtocolName()), gettype($infoInstance))); if (!($infoInstance instanceof ShareableInfo)) { // Should not happen throw new LogicException(sprintf('infoInstance[]=%s does not implement ShareableInfo', gettype($infoInstance))); @@ -282,11 +282,11 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { $infoInstance->fillWithListenerInformation($this); // Check it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: Checking socketInstance ... (socketResource=%s)', strtoupper($this->getProtocolName()), $socketInstance->getSocketResource())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: Checking socketInstance ... (socketResource=%s)', strtoupper($this->getProtocolName()), $socketInstance->getSocketResource())); $isRegistered = $this->getRegistryInstance()->isSocketRegistered($infoInstance, $socketInstance); // Return result - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: isRegistered=%d - EXIT!', strtoupper($this->getProtocolName()), intval($isRegistered))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: isRegistered=%d - EXIT!', strtoupper($this->getProtocolName()), intval($isRegistered))); return $isRegistered; } @@ -298,7 +298,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { */ public function accept (Visitor $visitorInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - CALLED!'); // Visit this listener $visitorInstance->visitListener($this); @@ -310,7 +310,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!'); } /** @@ -321,10 +321,10 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { */ public function monitorIncomingRawData () { // Check if an incoming socket is registered - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: CALLED!', strtoupper($this->getProtocolName()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: CALLED!', strtoupper($this->getProtocolName()))); if (!$this->getRegistryInstance()->isIncomingSocketRegistered($this)) { // Skip further processing - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: No socket of type "%s" registered. - EXIT!', strtoupper($this->getProtocolName()), StorableSocket::CONNECTION_TYPE_INCOMING)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: No socket of type "%s" registered. - EXIT!', strtoupper($this->getProtocolName()), StorableSocket::CONNECTION_TYPE_INCOMING)); return; } @@ -333,35 +333,43 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { $iteratorInstance = $this->getRegistryInstance()->getIterator([$this->getProtocolName()]); // Should be valid instance - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: iteratorInstance[]=%s', strtoupper($this->getProtocolName()), gettype($iteratorInstance))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: iteratorInstance[]=%s', strtoupper($this->getProtocolName()), gettype($iteratorInstance))); if (is_null($iteratorInstance)) { // Throw NPE throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); } // Is it valid? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: iteratorInstance->valid()=%d', strtoupper($this->getProtocolName()), intval($iteratorInstance->valid()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: iteratorInstance->valid()=%d', strtoupper($this->getProtocolName()), intval($iteratorInstance->valid()))); if (!$iteratorInstance->valid()) { // Then rewind it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: Rewinding iterator ...', strtoupper($this->getProtocolName()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: Rewinding iterator ...', strtoupper($this->getProtocolName()))); $iteratorInstance->rewind(); + + // Is it still not valid? + if (!$iteratorInstance->valid()) { + // Then the list is empty maybe, skip below code + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: socketInstance->socketType=%s has no entries,iteratorInstance->count()=%d - EXIT!', strtoupper($this->getProtocolName()), $socketInstance->getSocketType(), $iteratorInstance->count())); + return; + } } // Get current instance + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: Invoking iteratorInstance->current() ...', strtoupper($this->getProtocolName()))); $socketInstance = $iteratorInstance->current(); // Is NULL returned? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance[]=%s', strtoupper($this->getProtocolName()), gettype($socketInstance))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: socketInstance[]=%s', strtoupper($this->getProtocolName()), gettype($socketInstance))); if (!($socketInstance instanceof StorableSocket)) { // Then abort here - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance=NULL - EXIT!', strtoupper($this->getProtocolName()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: socketInstance=NULL - EXIT!', strtoupper($this->getProtocolName()))); return; } elseif ($socketInstance->getSocketType() != StorableSocket::CONNECTION_TYPE_INCOMING) { // Advance to next $iteratorInstance->next(); // Socket is not incoming socket, may happen in current iterator implementation - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance->socketType=%s is not wanted - EXIT!', strtoupper($this->getProtocolName()), $socketInstance->getSocketType())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: socketInstance->socketType=%s is not wanted - EXIT!', strtoupper($this->getProtocolName()), $socketInstance->getSocketType())); return; } @@ -373,7 +381,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { $iteratorInstance->next(); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); } /** @@ -384,7 +392,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { */ protected function doListenSocketSelect () { // Validate parameter and socket instance - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: CALLED!', strtoupper($this->getProtocolName()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: CALLED!', strtoupper($this->getProtocolName()))); if(!$this->getSocketInstance()->isValidSocket()) { // Invalid socket throw new LogicException(sprintf('this->socketInstance->socketResource=%s is not valid', $this->getSocketInstance()->getSocketResource())); @@ -394,26 +402,26 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { $socketInstance = SocketFactory::createNextAcceptedSocketFromPool($this->getPoolInstance(), $this->getSocketInstance()); // Is socket instance set? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance[]=%s accepted.', strtoupper($this->getProtocolName()), gettype($socketInstance))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: socketInstance[]=%s accepted.', strtoupper($this->getProtocolName()), gettype($socketInstance))); if (!($socketInstance instanceof StorableSocket)) { // Nothing has changed on the listener - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: No new connection on listener ... - EXIT!', strtoupper($this->getProtocolName()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: No new connection on listener ... - EXIT!', strtoupper($this->getProtocolName()))); return; } // Get a connection info instance - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: Creating infoInstance for connection type %s ...', strtoupper($this->getProtocolName()), StorableSocket::CONNECTION_TYPE_INCOMING)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: Creating infoInstance for connection type %s ...', strtoupper($this->getProtocolName()), StorableSocket::CONNECTION_TYPE_INCOMING)); $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($this->getProtocolName(), StorableSocket::CONNECTION_TYPE_INCOMING); // Is the instance set? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: infoInstance[]=%s', strtoupper($this->getProtocolName()), gettype($infoInstance))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: infoInstance[]=%s', strtoupper($this->getProtocolName()), gettype($infoInstance))); if (!($infoInstance instanceof ShareableInfo)) { // Should not happen throw new LogicException(sprintf('infoInstance[]=%s does not implement ShareableInfo', gettype($infoInstance))); } // Will the info instance with listener data - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: Invoking infoInstance->fillWithSocketPeerInformation(%s) ...', strtoupper($this->getProtocolName()), $socketInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: Invoking infoInstance->fillWithSocketPeerInformation(%s) ...', strtoupper($this->getProtocolName()), $socketInstance->__toString())); $infoInstance->fillWithSocketPeerInformation($socketInstance); // Init peer address/port @@ -428,20 +436,20 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { // Set all required data //* DEBUG-DIE: */ $infoInstance->debugInstance(); - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: peerAddress=%s,peerPort=%d', strtoupper($this->getProtocolName()), $peerAddress, $peerPort)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: peerAddress=%s,peerPort=%d', strtoupper($this->getProtocolName()), $peerAddress, $peerPort)); $socketInstance->setSenderAddress($peerAddress); $socketInstance->setSenderPort($peerPort); // Register the socket with the registry and with the faked array - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: Registering socketInstance->socketResource=%s,socketType=%s ...', strtoupper($this->getProtocolName()), $socketInstance->getSocketResource(), $socketInstance->getSocketType())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: Registering socketInstance->socketResource=%s,socketType=%s ...', strtoupper($this->getProtocolName()), $socketInstance->getSocketResource(), $socketInstance->getSocketType())); $this->getRegistryInstance()->registerSocketInstance($infoInstance, $socketInstance); // Invoke private method - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: Invoking this->handleIncomingSocket(%s) ...', strtoupper($this->getProtocolName()), $socketInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: Invoking this->handleIncomingSocket(%s) ...', strtoupper($this->getProtocolName()), $socketInstance->__toString())); $this->handleIncomingSocket($socketInstance); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); } /** @@ -452,7 +460,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { */ public function ifListenerAcceptsPackageData (DeliverablePackage $packageInstance) { // Check if same socket protocol - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: packageInstance=%s - CALLED!', strtoupper($this->getProtocolName()), $packageInstance)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: packageInstance=%s - CALLED!', strtoupper($this->getProtocolName()), $packageInstance)); $socketProtocol = $this->getSocketInstance()->getSocketProtocol(); // Get UNL instance @@ -462,11 +470,11 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { $unlProtocol = $locatorInstance->getUnlProtocol(); // Is same protocol? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: locatorInstance->unlProtocol=%s,socketProtocol=%s', strtoupper($this->getProtocolName()), $unlProtocol, $socketProtocol)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-LISTENER: locatorInstance->unlProtocol=%s,socketProtocol=%s', strtoupper($this->getProtocolName()), $unlProtocol, $socketProtocol)); $accepts = ($unlProtocol == $socketProtocol); // Return the result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: accepts=%d - EXIT!', strtoupper($this->getProtocolName()), $accepts)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-LISTENER: accepts=%d - EXIT!', strtoupper($this->getProtocolName()), $accepts)); return $accepts; } diff --git a/application/hub/classes/miner/class_BaseHubMiner.php b/application/hub/classes/miner/class_BaseHubMiner.php index fb7660871..c34a17047 100644 --- a/application/hub/classes/miner/class_BaseHubMiner.php +++ b/application/hub/classes/miner/class_BaseHubMiner.php @@ -98,7 +98,7 @@ abstract class BaseHubMiner extends BaseHubSystem implements Updateable { */ private function initMiner () { // Add own instance to registry - ObjectRegistry::getRegistry('hub')->addInstance('miner', $this); + ObjectRegistry::getRegistry('factory')->addInstance('miner', $this); // Init the state MinerStateFactory::createMinerStateInstanceByName('init'); diff --git a/application/hub/classes/nodes/class_BaseHubNode.php b/application/hub/classes/nodes/class_BaseHubNode.php index 706e2b5e5..2f12486c3 100644 --- a/application/hub/classes/nodes/class_BaseHubNode.php +++ b/application/hub/classes/nodes/class_BaseHubNode.php @@ -157,7 +157,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC $this->setCryptoInstance($cryptoInstance); // Set the node instance in registry - ObjectRegistry::getRegistry('hub')->addInstance('node', $this); + ObjectRegistry::getRegistry('factory')->addInstance('node', $this); // Init state which sets the state to 'init' $this->initState(); @@ -640,7 +640,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC } // Get the controller here - $controllerInstance = ObjectRegistry::getRegistry('hub')->getInstance('controller'); + $controllerInstance = ObjectRegistry::getRegistry('generic')->getInstance('controller'); // Run all filters for the hub activation $controllerInstance->executeActivationFilters($requestInstance, $responseInstance); diff --git a/application/hub/classes/producer/miner/class_BaseMinerProducer.php b/application/hub/classes/producer/miner/class_BaseMinerProducer.php index 2e74165db..30ed322aa 100644 --- a/application/hub/classes/producer/miner/class_BaseMinerProducer.php +++ b/application/hub/classes/producer/miner/class_BaseMinerProducer.php @@ -49,7 +49,7 @@ abstract class BaseMinerProducer extends BaseProducer { parent::__construct($className); // Get miner instance - $minerInstance = ObjectRegistry::getRegistry('hub')->getInstance('miner'); + $minerInstance = ObjectRegistry::getRegistry('factory')->getInstance('miner'); // Change state to next state $minerInstance->blockProducerHasInitialized($this); diff --git a/application/hub/classes/registry/socket/class_SocketRegistry.php b/application/hub/classes/registry/socket/class_SocketRegistry.php index 19c5980c4..c86eb9134 100644 --- a/application/hub/classes/registry/socket/class_SocketRegistry.php +++ b/application/hub/classes/registry/socket/class_SocketRegistry.php @@ -17,8 +17,8 @@ use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Registry\BaseRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Registry\Register; -use Org\Mxchange\CoreFramework\Registry\Sub\SubRegistry; use Org\Mxchange\CoreFramework\Socket\SocketAlreadyRegisteredException; /** @@ -48,9 +48,21 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke const EXCEPTION_SOCKET_NOT_REGISTERED = 0xd200; /** - * Instance of this class + * An instance of this class */ - private static $registryInstance = NULL; + private static $selfInstance = NULL; + + /** + * All instances of this class + */ + private static $registryInstances = [ + // TCP socket registry + StorableSocket::SOCKET_PROTOCOL_TCP => NULL, + // UDP socket registry + StorableSocket::SOCKET_PROTOCOL_UDP => NULL, + // file socket registry + StorableSocket::SOCKET_PROTOCOL_FILE => NULL, + ]; /** * Protected constructor @@ -59,7 +71,18 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ private function __construct () { // Call parent constructor + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('SOCKET-REGISTRY: CONSTRUCTED!'); parent::__construct(__CLASS__); + + // Init all instances + foreach (array_keys($this->getInstanceRegistry()) as $registryKey) { + // Initialize this instance + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: Initializing registryKey=%s ...', $registryKey)); + self::$registryInstances[$registryKey] = ObjectRegistry::getRegistry('sockets'); + } + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('SOCKET-REGISTRY: CONSTRUCTED!'); } /** @@ -68,14 +91,25 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke * @return $registryInstance An instance of this class */ public static final function createSocketRegistry () { - // Is an instance there? - if (is_null(self::$registryInstance)) { - // Not yet, so create one - self::$registryInstance = new SocketRegistry(); + // Is there an instance? + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: self::selfInstance[]=%s - CALLED!', gettype(self::$selfInstance))); + if (is_null(self::$selfInstance)) { + // Get instance + self::$selfInstance = new SocketRegistry(); } // Return the instance - return self::$registryInstance; + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: self::selfInstance=%s - EXIT!', self::$selfInstance->__toString())); + return self::$selfInstance; + } + + /** + * Getter for all registry instances + * + * @return $registryInstances An array with all registry instances + */ + public final function getInstanceRegistry () { + return self::$registryInstances; } /** @@ -85,9 +119,9 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke * @param $infoInstance An instance of a ShareableInfo class * @return $key A string representation of the socket for the registry */ - private function generateSubRegistryKeyFromInfoInstance (ShareableInfo $infoInstance) { + private function generateObjectRegistryKeyFromInfoInstance (ShareableInfo $infoInstance) { // Get connection type and port number and add both together - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: infoInstance=%s - CALLED!', $infoInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: infoInstance=%s - CALLED!', $infoInstance->__toString())); $key = sprintf('%s:%s:%s:%s:%s', $infoInstance->__toString(), $infoInstance->getProtocolName(), @@ -97,7 +131,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke ); // Return resulting key - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s - EXIT!', $key)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: key=%s - EXIT!', $key)); return $key; } @@ -108,16 +142,12 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke * @return $key A string representation of the listener for the registry */ private function getRegistryKeyFromInfo (ShareableInfo $infoInstance) { - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: ,infoInstance=' . $infoInstance->__toString() . ' - CALLED!'); - // Get the key + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: infoInstance=%s - CALLED!', $infoInstance->__toString())); $key = $infoInstance->getProtocolName(); - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ' - EXIT!'); - // Return resulting key + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: key=%s - EXIT!', $key)); return $key; } @@ -128,19 +158,15 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke * @return $isRegistered Whether the listener is registered */ private function isInfoRegistered (ShareableInfo $infoInstance) { - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ' - CALLED!'); - // Get the key - $key = $this->getRegistryKeyFromInfo($infoInstance); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ' - CALLED!'); + $key = $this->generateObjectRegistryKeyFromInfoInstance($infoInstance); // Determine it - $isRegistered = $this->instanceExists($key); - - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!'); + $isRegistered = self::$registryInstances[$infoInstance->getProtocolName()]->instanceExists($key); // Return result + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!'); return $isRegistered; } @@ -154,42 +180,38 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ public function isSocketRegistered (ShareableInfo $infoInstance, StorableSocket $socketInstance) { // Default is not registered - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - CALLED!'); $isRegistered = FALSE; // First, check for the instance, there can be only once if ($this->isInfoRegistered($infoInstance)) { // That one is found so "get" a registry key from it - $key = $this->getRegistryKeyFromInfo($infoInstance); + $key = $this->generateObjectRegistryKeyFromInfoInstance($infoInstance); // Get the registry - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',key=' . $key . ' - Trying to get instance ...'); - $registryInstance = $this->getInstance($key); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',key=' . $key . ' - Trying to get instance ...'); + $registryInstance = self::$registryInstances[$infoInstance->getProtocolName()]->getInstance($key); // "Get" a key for the socket - $socketKey = $this->generateSubRegistryKeyFromInfoInstance($infoInstance); - - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',key=' . $key . ',socketKey=' . $socketKey . ' - Checking existence ...'); + $socketKey = $this->generateObjectRegistryKeyFromInfoInstance($infoInstance); // Is it there? + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',key=' . $key . ',socketKey=' . $socketKey . ' - Checking existence ...'); if ($registryInstance->instanceExists($socketKey)) { - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: Found instance for socketKey=' . $socketKey . ':' . $registryInstance->getInstance($socketKey)); - // Get the instance + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('SOCKET-REGISTRY: Found instance for socketKey=' . $socketKey . ':' . $registryInstance->getInstance($socketKey)); $registeredInstance = $registryInstance->getInstance($socketKey); // Is it StorableSocket and same socket? $isRegistered = (($registeredInstance instanceof StorableSocket) && ($registeredInstance->equals($socketInstance))); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: Final result: isRegistered(' . $socketInstance->getSocketResource() . ')=' . intval($isRegistered)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('SOCKET-REGISTRY: Final result: isRegistered(' . $socketInstance->getSocketResource() . ')=' . intval($isRegistered)); } } // Return the result - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!'); return $isRegistered; } @@ -203,39 +225,29 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ public function registerSocketInstance (ShareableInfo $infoInstance, StorableSocket $socketInstance) { // Is the socket already registered? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: infoInstance->protocolName=%s,infoInstance->socketResource[%s]=%s - CALLED!', $infoInstance->getProtocolName(), gettype($socketInstance->getSocketResource()), $socketInstance->getSocketResource())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: infoInstance->protocolName=%s,infoInstance->socketResource[%s]=%s - CALLED!', $infoInstance->getProtocolName(), gettype($socketInstance->getSocketResource()), $socketInstance->getSocketResource())); if ($this->isSocketRegistered($infoInstance, $socketInstance)) { // Throw the exception throw new SocketAlreadyRegisteredException(array($infoInstance, $socketInstance->getSocketResource()), BaseListener::EXCEPTION_SOCKET_ALREADY_REGISTERED); } + // Create registry key + $socketKey = $this->generateObjectRegistryKeyFromInfoInstance($infoInstance); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: socketKey=%s', $socketKey)); + // Does the instance exist? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: Checking if infoInstance=%s is registered ...', $infoInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: Checking if infoInstance=%s is registered ...', $infoInstance->__toString())); if (!$this->isInfoRegistered($infoInstance)) { - // No, not found so we create a sub registry (not needed to configure!) - $registryInstance = SubRegistry::createSubRegistry(); - // Now we can create the sub-registry for this info - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: Adding infoInstance=%s to registry ...', $infoInstance->__toString())); - $this->addInstance($this->getRegistryKeyFromInfo($infoInstance), $registryInstance); - } else { - // Get the sub-registry back - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: Getting sub-registry from infoInstance=%s ...', $infoInstance->__toString())); - $registryInstance = $this->getInstance($this->getRegistryKeyFromInfo($infoInstance)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: Adding socketInstance=%s to registry ...', $socketInstance->__toString())); + self::$registryInstances[$socketInstance->getSocketProtocol()]->addInstance($socketKey, $socketInstance); } - // Get a key for sub-registries - $socketKey = $this->generateSubRegistryKeyFromInfoInstance($infoInstance); - - // We have a sub-registry, the socket key and the socket, now we need to put all together - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: socketKey=%s,socketResource[%s]=%s - adding socket container instance ...', $socketKey, gettype($socketInstance->getSocketResource()), $socketInstance->getSocketResource())); - $registryInstance->addInstance($socketKey, $socketInstance); - // Also register all instances from info instance in socket $socketInstance->registerInfoInstance($infoInstance); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('SOCKET-REGISTRY: EXIT!'); } /** @@ -247,28 +259,21 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ public function getRegisteredSocketResource (Listenable $listenerInstance) { // The socket must be registered before we can return it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: listenerInstance=%s - CALLED!', $listenerInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: listenerInstance=%s - CALLED!', $listenerInstance->__toString())); if (!$this->isInfoRegistered($listenerInstance)) { // Throw the exception throw new NoSocketRegisteredException ($listenerInstance, self::EXCEPTION_SOCKET_NOT_REGISTERED); } - // Now get the key from the listener - $registryKey = $this->getRegistryKeyFromInfo($listenerInstance); - // Get a socket key - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: registryKey=%s', $registryKey)); - $socketKey = $this->generateSubRegistryKeyFromInfoInstance($listenerInstance); - - // Get the registry - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: socketKey=%s', $socketKey)); - $registryInstance = $this->getInstance($registryKey); + $socketKey = $this->generateObjectRegistryKeyFromInfoInstance($listenerInstance); - // And the final socket resource - $socketInstance = $registryInstance->getInstance($socketKey); + // Get socket resource + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: socketKey=%s', $socketKey)); + $socketInstance = self::$registryInstances[$listenerInstance->getProtocolName()]->getInstance($socketKey); // Return the resource - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: listenerInstance=%s,socketInstance[]=%s - EXIT!', $listenerInstance->__toString(), gettype($socketInstance))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: listenerInstance=%s,socketInstance[]=%s - EXIT!', $listenerInstance->__toString(), gettype($socketInstance))); return $socketInstance; } @@ -280,42 +285,42 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ public function determineInfoInstanceByPackageInstance (DeliverablePackage $packageInstance) { // Init info instance - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: packageInstance=%s - CALLED!', $packageInstance)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: packageInstance=%s - CALLED!', $packageInstance)); $infoInstance = NULL; //* DEBUG-DIE: */ die(__METHOD__ . ':packageInstance=' . print_r($packageInstance, TRUE)); // Get all keys and check them - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: this->instanceRegistry()=%d', count($this->getInstanceRegistry()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: this->instanceRegistry()=%d', count($this->getInstanceRegistry()))); foreach ($this->getInstanceRegistry() as $key => $registryInstance) { // This is always a SubRegistry instance - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,registryInstance=%s', $key, $registryInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: key=%s,registryInstance=%s', $key, $registryInstance->__toString())); foreach ($registryInstance->getInstanceRegistry() as $subKey => $socketInstance) { // Is this a StorableSocket instance and is the address the same? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s,socketInstance=%s', $key, $subKey, $socketInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s,socketInstance=%s', $key, $subKey, $socketInstance->__toString())); if (($socketInstance instanceof StorableSocket) && ($socketInstance->ifAddressMatches($packageInstance->getRecipientUnl()))) { // Get listener and helper instances - /* NOSY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s, calling socketInstance->getListenerInstance() ...', $key, $subKey)); + /* NOSY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s, calling socketInstance->getListenerInstance() ...', $key, $subKey)); //* DEBUG-DIE: */ die(__METHOD__ . ': socketInstance=' . print_r($socketInstance, TRUE)); $listenerInstance = $socketInstance->getListenerInstance(); $helperInstance = $socketInstance->getHelperInstance(); // Is a listener or helper set? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s,listenerInstance[]=%s,helperInstance[]=%s', $key, $subKey, gettype($listenerInstance), gettype($helperInstance))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s,listenerInstance[]=%s,helperInstance[]=%s', $key, $subKey, gettype($listenerInstance), gettype($helperInstance))); if ($listenerInstance instanceof Listenable) { // Found a listener, so get the info instance first - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s: Getting infoInstance for listenerInstance->protocolName=%s ...', $key, $subKey, $listenerInstance->getProtocolName())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s: Getting infoInstance for listenerInstance->protocolName=%s ...', $key, $subKey, $listenerInstance->getProtocolName())); $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($listenerInstance->getProtocolName(), 'helper'); // Fill info instance with listener data - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s: Invoking infoInstance->fillWithListenerInformation(%s) ...', $key, $subKey, $listenerInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s: Invoking infoInstance->fillWithListenerInformation(%s) ...', $key, $subKey, $listenerInstance->__toString())); $infoInstance->fillWithListenerInformation($listenerInstance); } elseif ($helperInstance instanceof ConnectionHelper) { // Found a helper, so get the info instance first - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s: Getting infoInstance for helperInstance->protocolName=%s ...', $key, $subKey, $helperInstance->getProtocolName())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s: Getting infoInstance for helperInstance->protocolName=%s ...', $key, $subKey, $helperInstance->getProtocolName())); $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($helperInstance->getProtocolName(), 'helper'); // Helper is found - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s: Invoking infoInstance->fillWithHelperInformation(%s) ...', $key, $subKey, $helperInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s: Invoking infoInstance->fillWithHelperInformation(%s) ...', $key, $subKey, $helperInstance->__toString())); $infoInstance->fillWithConnectionHelperInformation($helperInstance); } else { // Not supported state! @@ -323,22 +328,22 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke } // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s,infoInstance[%s]=%s with protocol %s - FOUND!', $key, $subKey, gettype($infoInstance), $infoInstance->__toString(), $infoInstance->getProtocolName())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s,infoInstance[%s]=%s with protocol %s - FOUND!', $key, $subKey, gettype($infoInstance), $infoInstance->__toString(), $infoInstance->getProtocolName())); break; } } // Is no longer NULL set? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: infoInstance[]=%s', gettype($infoInstance))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: infoInstance[]=%s', gettype($infoInstance))); if (!is_null($infoInstance)) { // Then skip here, too - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: BREAK!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('SOCKET-REGISTRY: BREAK!'); break; } } // Return the info instance - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: infoInstance[]=%s - EXIT!', gettype($infoInstance))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: infoInstance[]=%s - EXIT!', gettype($infoInstance))); return $infoInstance; } @@ -351,18 +356,18 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ public function isIncomingSocketRegistered (Listenable $listenerInstance) { // Default is not found - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: listenerInstance=%s (protocol: %s) - CALLED!', $listenerInstance->__toString(), strtoupper($listenerInstance->getProtocolName()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: listenerInstance=%s (protocol: %s) - CALLED!', $listenerInstance->__toString(), strtoupper($listenerInstance->getProtocolName()))); //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: this=%s', __METHOD__, __LINE__, print_r($this, TRUE))); $isRegistered = FALSE; // Search listener's socket sub-registry - $registryInstance = $this->getInstance($listenerInstance->getProtocolName()); + $registryInstance = self::$registryInstances[$listenerInstance->getProtocolName()]; //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: listenerInstance->protocolName=%s,registryInstance=%s', __METHOD__, __LINE__, $listenerInstance->getProtocolName(), print_r($registryInstance, TRUE))); // Get all sockets from it foreach ($registryInstance->getInstanceRegistry() as $instanceKey => $socketInstance) { // Is this socket as requested? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: instanceKey=%s,socketInstance=%s,socketType=%s', $instanceKey, $socketInstance->__toString(), $socketInstance->getSocketType())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('SOCKET-REGISTRY: instanceKey=%s,socketInstance=%s,socketType=%s', $instanceKey, $socketInstance->__toString(), $socketInstance->getSocketType())); //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: socketInstance=%s', __METHOD__, __LINE__, print_r($socketInstance, TRUE))); if ($socketInstance->getSocketType() == StorableSocket::CONNECTION_TYPE_INCOMING) { // Is found! @@ -372,7 +377,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke } // Return status - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: isRegistered=%d - EXIT!', intval($isRegistered))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-REGISTRY: isRegistered=%d - EXIT!', intval($isRegistered))); return $isRegistered; } diff --git a/application/hub/classes/tasks/crawler/communicator/class_CrawlerNodeCommunicatorTask.php b/application/hub/classes/tasks/crawler/communicator/class_CrawlerNodeCommunicatorTask.php index bc16f337a..22c4d9628 100644 --- a/application/hub/classes/tasks/crawler/communicator/class_CrawlerNodeCommunicatorTask.php +++ b/application/hub/classes/tasks/crawler/communicator/class_CrawlerNodeCommunicatorTask.php @@ -81,7 +81,7 @@ class CrawlerNodeCommunicatorTask extends BaseHubTask implements Taskable, Visit $communicatorInstance = CommunicatorFactory::createCommunicatorInstance('crawler_node_communicator_class', 'node'); // Get the current crawler state from registry - $stateInstance = ObjectRegistry::getRegistry('hub')->getInstance('crawler')->getStateInstance(); + $stateInstance = ObjectRegistry::getRegistry('factory')->getInstance('crawler')->getStateInstance(); // Debug message /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-NODE-COMMUNICATOR-TASK: Executing stateInstance=' . $stateInstance->__toString()); diff --git a/application/hub/classes/tasks/miner/block_fetcher/class_MinerBlockFetcherTask.php b/application/hub/classes/tasks/miner/block_fetcher/class_MinerBlockFetcherTask.php index bf48d45c7..3cba4fa19 100644 --- a/application/hub/classes/tasks/miner/block_fetcher/class_MinerBlockFetcherTask.php +++ b/application/hub/classes/tasks/miner/block_fetcher/class_MinerBlockFetcherTask.php @@ -85,7 +85,7 @@ class MinerBlockFetcherTask extends BaseHubTask implements Taskable, Visitable { * * Please report any bugs you encounter to me. */ - ObjectRegistry::getRegistry('hub')->getInstance('miner')->doSearchForBlocks(); + ObjectRegistry::getRegistry('factory')->getInstance('miner')->doSearchForBlocks(); } /** diff --git a/application/hub/classes/tasks/miner/block_producer/class_MinerRealGenesisBlockProducerTask.php b/application/hub/classes/tasks/miner/block_producer/class_MinerRealGenesisBlockProducerTask.php index d32342991..7412f9cd7 100644 --- a/application/hub/classes/tasks/miner/block_producer/class_MinerRealGenesisBlockProducerTask.php +++ b/application/hub/classes/tasks/miner/block_producer/class_MinerRealGenesisBlockProducerTask.php @@ -80,7 +80,7 @@ class MinerRealGenesisBlockProducerTask extends BaseHubTask implements Taskable, $producerInstance = ProducerFactory::createProducerInstance('miner_real_genesis_block_producer_class', 'real_unit'); // Get the current miner state from registry - $stateInstance = ObjectRegistry::getRegistry('hub')->getInstance('miner')->getStateInstance(); + $stateInstance = ObjectRegistry::getRegistry('factory')->getInstance('miner')->getStateInstance(); // Debug message /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-GENESIS-BLOCK-PRODUCER-TASK: Executing stateInstance=' . $stateInstance->__toString()); diff --git a/application/hub/classes/tasks/miner/block_producer/class_MinerTestGenesisBlockProducerTask.php b/application/hub/classes/tasks/miner/block_producer/class_MinerTestGenesisBlockProducerTask.php index 26ad2e2a1..900717d7b 100644 --- a/application/hub/classes/tasks/miner/block_producer/class_MinerTestGenesisBlockProducerTask.php +++ b/application/hub/classes/tasks/miner/block_producer/class_MinerTestGenesisBlockProducerTask.php @@ -80,7 +80,7 @@ class MinerTestGenesisBlockProducerTask extends BaseHubTask implements Taskable, $producerInstance = ProducerFactory::createProducerInstance('miner_test_genesis_block_producer_class', 'test_unit'); // Get the current miner state from registry - $stateInstance = ObjectRegistry::getRegistry('hub')->getInstance('miner')->getStateInstance(); + $stateInstance = ObjectRegistry::getRegistry('factory')->getInstance('miner')->getStateInstance(); // Debug message /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-TEST-GENESIS-BLOCK-PRODUCER-TASK: Executing stateInstance=' . $stateInstance->__toString()); diff --git a/core b/core index d80aa0602..4fc7b52c4 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit d80aa06027f7eafcabc7c5e307d2126456a6dc0a +Subproject commit 4fc7b52c4eb7287dbfd78bd4bdc8adaea03f7d5c