* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class MonitorPoolIterator extends BaseIterator implements Iterator {
+class MonitorPoolIterator extends BaseIterator implements Iterator, Registerable {
/**
* Key for the global list index
*/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class TaskPoolIterator extends BaseIterator implements Iterator {
+class TaskPoolIterator extends BaseIterator implements Iterator, Registerable {
/**
* Key for the global list index
*/
// Visit this pool
$visitorInstance->visitPool($this);
- // Get a new iterator instance
- $iteratorInstance = ObjectFactory::createObjectByConfiguredName($visitorInstance->getVisitorMode() . '_pool_iterator_class', array($this->getPoolEntriesInstance()));
+ // Do we have a registry instance for this visitor's iterator?
+ if (Registry::getRegistry()->instanceExists($visitorInstance->getVisitorMode() . '_pool_iterator')) {
+ // Get the instance from registry
+ $iteratorInstance = Registry::getRegistry()->getInstance($visitorInstance->getVisitorMode() . '_pool_iterator');
+ } else {
+ // Get a new iterator instance
+ $iteratorInstance = ObjectFactory::createObjectByConfiguredName($visitorInstance->getVisitorMode() . '_pool_iterator_class', array($this->getPoolEntriesInstance()));
+
+ // Add it to the registry
+ Registry::getRegistry()->addInstance($visitorInstance->getVisitorMode() . '_pool_iterator', $iteratorInstance);
+ }
// Reset the counter
$iteratorInstance->rewind();