Changeset View
Changeset View
Standalone View
Standalone View
src/future/FutureProxy.php
| Show All 21 Lines | abstract class FutureProxy extends Future { | ||||
| protected function getProxiedFuture() { | protected function getProxiedFuture() { | ||||
| if (!$this->proxied) { | if (!$this->proxied) { | ||||
| throw new Exception(pht('The proxied future has not been provided yet.')); | throw new Exception(pht('The proxied future has not been provided yet.')); | ||||
| } | } | ||||
| return $this->proxied; | return $this->proxied; | ||||
| } | } | ||||
| public function isReady() { | public function isReady() { | ||||
| return $this->getProxiedFuture()->isReady(); | if ($this->hasResult()) { | ||||
| return true; | |||||
| } | } | ||||
| public function resolve() { | $proxied = $this->getProxiedFuture(); | ||||
| $result = $this->getProxiedFuture()->resolve(); | |||||
| $is_ready = $proxied->isReady(); | |||||
| if ($proxied->hasResult()) { | |||||
| $result = $proxied->getResult(); | |||||
| $result = $this->didReceiveResult($result); | $result = $this->didReceiveResult($result); | ||||
| $this->setResult($result); | $this->setResult($result); | ||||
| return $this->getResult(); | |||||
| } | } | ||||
| public function setException(Exception $ex) { | return $is_ready; | ||||
| $this->getProxiedFuture()->setException($ex); | |||||
| return $this; | |||||
| } | } | ||||
| public function getException() { | public function resolve() { | ||||
| return $this->getProxiedFuture()->getException(); | $this->getProxiedFuture()->resolve(); | ||||
| $this->isReady(); | |||||
| return $this->getResult(); | |||||
| } | } | ||||
| public function getReadSockets() { | public function getReadSockets() { | ||||
| return $this->getProxiedFuture()->getReadSockets(); | return $this->getProxiedFuture()->getReadSockets(); | ||||
| } | } | ||||
| public function getWriteSockets() { | public function getWriteSockets() { | ||||
| return $this->getProxiedFuture()->getWriteSockets(); | return $this->getProxiedFuture()->getWriteSockets(); | ||||
| Show All 10 Lines | |||||