示例#1
0
文件: Barrier.php 项目: mheydt/scalr
 /**
  * @param array $config
  * @key Scalr_Service_Zookeeper $zookeeper
  * @key string $path
  * @key int $quorum
  * @key int|Scalr_Util_Timeout $timeout
  * @key bool $autoDelete
  */
 function __construct($config)
 {
     foreach ($config as $k => $v) {
         $this->{$k} = $v;
     }
     foreach (array("zookeeper", "path", "quorum") as $k) {
         if (!$this->{$k}) {
             throw new Scalr_Service_Zookeeper_Exception(sprintf("'%s' is required config option", $k));
         }
     }
     if ($this->timeout) {
         $this->timeout = Scalr_Util_Timeout::get($this->timeout);
     }
 }
示例#2
0
 /**
  * @param $config
  * @key Scalr_Service_Zookeeper $zookeeper
  * @key string $path
  * @key int $quorum
  * @key Scalr_Util_Timeout|int $timeout
  */
 function __construct($config)
 {
     foreach ($config as $k => $v) {
         $this->{$k} = $v;
     }
     foreach (array("zookeeper", "path", "quorum") as $k) {
         if (!$this->{$k}) {
             throw new Scalr_Service_Zookeeper_Exception(sprintf("'%s' is required config option", $k));
         }
     }
     if ($this->timeout) {
         $this->timeout = Scalr_Util_Timeout::get($this->timeout);
     }
     $this->lock = new Scalr_Service_Zookeeper_Lock(array("zookeeper" => $this->zookeeper, "path" => "{$this->path}/lock"));
     $this->logger = Logger::getLogger(__CLASS__);
 }