Example #1
0
 public static function initResource($inifile)
 {
     //Timer::start("a");
     $arr = parse_ini_file($inifile);
     /*
     		Timer::stop("a");
     		Timer::start("b");
     		$p = new Properties();
     		$fp = fopen($inifile.'2','r');
     		$p->load($fp);
     		
     		//print_r($p->propertyNames());
     		Timer::stop("b");
     		Timer::printTime(10);
     		die();
     */
     if (!is_array($arr) || !count($arr) > 0) {
         die("core/ResourcePool : inifile " . $inifile . " not found\n");
     }
     Timer::start('ResourcePool::init::' . $class);
     $class = new ReflectionClass($arr['className']);
     $resourceInstance = $class->newInstance($arr);
     $resourceInstance->init();
     self::$resources = $resourceInstance;
     Timer::stop('ResourcePool::init::' . $class);
     //$resourceInstance
     //$resourceInstance->setStatus($status);
 }
Example #2
0
 function isForRun(ResourcePool $resources)
 {
     if ($this->status != 'init') {
         return false;
     }
     return $resources->checkAccess($this->resources, $this->uses, $this->block_all);
 }