예제 #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__);
 }