* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface Poolable extends FrameworkInterface {
+ /**
+ * Adds a listener instance to this pool
+ *
+ * @param $listenerInstance An instance of a Listenable class
+ * @return void
+ */
+ function addListener (Listenable $listenerInstance);
}
//
// Initialize the listener
$listenerInstance->initListener();
+ // Add this listener to the pool
+ $this->listenerPoolInstance->addListener($listenerInstance);
+
// Initialize the UDP listener
$listenerInstance = ObjectFactory::createObjectByConfiguredName('udp_listener_class', array($this));
// Initialize the listener
$listenerInstance->initListener();
+
+ // Add this listener to the pool
+ $this->listenerPoolInstance->addListener($listenerInstance);
}
}
// Return the prepared instance
return $listenerInstance;
}
+
+ /**
+ * Adds a listener instance to this pool
+ *
+ * @param $listenerInstance An instance of a Listenable class
+ * @return void
+ * @todo 0% done
+ */
+ public function addListener (Listenable $listenerInstance) {
+ $this->partialStub('Need to implement this method. listenerInstance=' . $listenerInstance->__toString());
+ }
}
-// [EOF]
+//
?>
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BasePool extends BaseHubSystem {
+ /**
+ * A list of instances for this pool
+ */
+ private $instancePool = array();
+
/**
* Protected constructor
*
// Call parent constructor
parent::__construct($className);
}
+
+ /**
+ * Adds an instance to a pool segment
+ *
+ * @param $poolSegment Name of the pool segment
+ * @param $instance An instance of a class we should add to the pool
+ * @return void
+ */
+ protected final function addInstance($poolName, FrameworkInterface $instance) {
+ $this->instancePool[$poolName][] = $instance;
+ }
}
// [EOF]
// Return the prepared instance
return $listenerInstance;
}
+
+ /**
+ * Adds a listener instance to this pool
+ *
+ * @param $listenerInstance An instance of a Listenable class
+ * @return void
+ */
+ public function addListener (Listenable $listenerInstance) {
+ // Add this listener instance to the instance list
+ parent::addInstance('listener', $listenerInstance);
+ }
}
// [EOF]