AsyncTask: Remove misleading methods getFromThreadStore(),saveToThreadStore(),removeFromThreadStore()

These methods are commonly mixed up when we talk about thread-local storage. What these things actually do is store persistent data on the worker thread.
This commit is contained in:
Dylan K. Taylor
2019-04-02 14:57:11 +01:00
parent 6214a9398d
commit 2c4f2810d2
4 changed files with 6 additions and 45 deletions

View File

@ -138,45 +138,6 @@ abstract class AsyncTask extends \Threaded{
return $this->submitted;
}
/**
* @see AsyncWorker::getFromThreadStore()
*
* @param string $identifier
*
* @return mixed
*/
public function getFromThreadStore(string $identifier){
if($this->worker === null or $this->isFinished()){
throw new \BadMethodCallException("Objects stored in AsyncWorker thread-local storage can only be retrieved during task execution");
}
return $this->worker->getFromThreadStore($identifier);
}
/**
* @see AsyncWorker::saveToThreadStore()
*
* @param string $identifier
* @param mixed $value
*/
public function saveToThreadStore(string $identifier, $value) : void{
if($this->worker === null or $this->isFinished()){
throw new \BadMethodCallException("Objects can only be added to AsyncWorker thread-local storage during task execution");
}
$this->worker->saveToThreadStore($identifier, $value);
}
/**
* @see AsyncWorker::removeFromThreadStore()
*
* @param string $identifier
*/
public function removeFromThreadStore(string $identifier) : void{
if($this->worker === null or $this->isFinished()){
throw new \BadMethodCallException("Objects can only be removed from AsyncWorker thread-local storage during task execution");
}
$this->worker->removeFromThreadStore($identifier);
}
/**
* Actions to execute when run
*/