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; } } }
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; } }
function delete() { try { $this->zookeeper->deleteRecursive($this->path); } catch (Scalr_Service_Zookeeper_Exception $ignore) { } }
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; } }
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) { } } }
/** * Delete queue and all her items */ function delete() { $this->zookeeper->deleteRecursive($this->path); }