Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 protected function executeSingleNode(NodeConnectionInterface $connection, SplQueue $commands)
 {
     $responses = array();
     $sizeOfPipe = count($commands);
     foreach ($commands as $command) {
         try {
             $connection->writeRequest($command);
         } catch (CommunicationException $exception) {
             return array_fill(0, $sizeOfPipe, $exception);
         }
     }
     for ($i = 0; $i < $sizeOfPipe; $i++) {
         $command = $commands->dequeue();
         try {
             $responses[$i] = $connection->readResponse($command);
         } catch (CommunicationException $exception) {
             $add = count($commands) - count($responses);
             $responses = array_merge($responses, array_fill(0, $add, $exception));
             break;
         }
     }
     return $responses;
 }
 /**
  * {@inheritdoc}
  */
 public function writeRequest(CommandInterface $command)
 {
     return $this->connection->writeRequest($command);
 }