コード例 #1
0
ファイル: Lock.php プロジェクト: rakesh-mohanta/scalr
 function release()
 {
     try {
         $this->zookeeper->delete($this->path);
     } catch (Scalr_Service_Zookeeper_Exception $e) {
         if ($e->getCode() != Scalr_Service_Zookeeper_Exception::NOT_FOUND) {
             throw $e;
         }
     }
 }
コード例 #2
0
ファイル: NodeRegistry.php プロジェクト: mheydt/scalr
 function nodesCapacity()
 {
     try {
         return $this->zookeeper->get($this->path)->numChildren;
     } catch (Scalr_Service_Zookeeper_Exception $e) {
         if ($e->getCode() == Scalr_Service_Zookeeper_Exception::NOT_FOUND) {
             return 0;
         }
         throw $e;
     }
 }
コード例 #3
0
ファイル: Barrier.php プロジェクト: mheydt/scalr
 function delete()
 {
     try {
         $this->zookeeper->deleteRecursive($this->path);
     } catch (Scalr_Service_Zookeeper_Exception $ignore) {
     }
 }
コード例 #4
0
ファイル: Set.php プロジェクト: mheydt/scalr
 function clear()
 {
     $this->init();
     $this->lock->acquire();
     try {
         foreach ($this->itemNames() as $name) {
             $this->zookeeper->delete("{$this->path}/{$name}");
         }
         $this->lock->release();
     } catch (Exception $e) {
         $this->lock->release();
         throw $e;
     }
 }
コード例 #5
0
ファイル: Election.php プロジェクト: sacredwebsite/scalr
 private function setStatus($status)
 {
     if ($status != self::STATUS_NOTSET) {
         try {
             $this->zookeeper->set("{$this->path}/status", serialize($status));
         } catch (Scalr_Service_Zookeeper_Exception $e) {
             if ($e->getCode() == Scalr_Service_Zookeeper_Exception::NOT_FOUND) {
                 $this->zookeeper->create("{$this->path}/status", serialize($status));
                 return;
             }
             throw $e;
         }
     } else {
         try {
             $this->zookeeper->delete("{$this->path}/status");
         } catch (Scalr_Service_Zookeeper_Exception $ignore) {
         }
     }
 }
コード例 #6
0
ファイル: Queue.php プロジェクト: rakesh-mohanta/scalr
 /**
  * Delete queue and all her items 
  */
 function delete()
 {
     $this->zookeeper->deleteRecursive($this->path);
 }