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();
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();
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();
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();
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();
*/
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);
);
// 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
}
// 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;
}
* @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
$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;
}
* @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?
$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;
}
*/
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)));
}
// 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;
}
}
$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);
$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);
}
}
*/
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();
*/
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.');
*/
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();
*/
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();
*/
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.');
*/
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();
*/
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();
*/
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.');
*/
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();
*/
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();
*/
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.');
*/
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();
*/
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();
*/
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();
$chatInstance->addExtraFilters($applicationInstance->getControllerInstance(), $responseInstance);
// Set the chat instance in registry
- ObjectRegistry::getRegistry('hub')->addInstance('chat', $chatInstance);
+ ObjectRegistry::getRegistry('factory')->addInstance('chat', $chatInstance);
}
}
*/
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();
*/
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();
*/
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();
*/
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();
*/
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();
*/
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();
*/
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();
*/
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');
*/
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');
$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);
}
}
*/
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');
*/
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())));
}
/**
*/
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);
$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())));
}
/**
*/
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)));
$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;
}
*/
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);
}
// 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!');
}
/**
*/
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;
}
$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;
}
$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())));
}
/**
*/
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()));
$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
// 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())));
}
/**
*/
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
$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;
}
*/
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');
$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();
}
// 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);
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);
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;
/**
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
*/
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!');
}
/**
* @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;
}
/**
* @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(),
);
// 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;
}
* @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;
}
* @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;
}
*/
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;
}
*/
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!');
}
/**
*/
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;
}
*/
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!
}
// 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;
}
*/
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!
}
// 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;
}
$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());
*
* Please report any bugs you encounter to me.
*/
- ObjectRegistry::getRegistry('hub')->getInstance('miner')->doSearchForBlocks();
+ ObjectRegistry::getRegistry('factory')->getInstance('miner')->doSearchForBlocks();
}
/**
$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());
$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());
-Subproject commit d80aa06027f7eafcabc7c5e307d2126456a6dc0a
+Subproject commit 4fc7b52c4eb7287dbfd78bd4bdc8adaea03f7d5c