예제 #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;
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function readResponse(CommandInterface $command)
 {
     return $this->connection->readResponse($command);
 }