Esempio n. 1
0
 /**
  * Send the result.
  */
 public function send()
 {
     //PS: I think this is a bit wrong. But this works, for now.
     $this->_transport->open();
     $this->_processor->process($this->_protocol, $this->_protocol);
     $this->_transport->close();
     parent::send();
 }
 /**
  * Default constructor
  *
  * @param Thrift\Transport\TTransport   $flumeTransport
  * @param ThriftFlumeEventServerClient  $client
  * @param int                           $level The minimum logging level at which this handler will be triggered
  * @param Boolean                       $bubble Whether the messages that are handled can bubble up the stack or not
  *
  * @SuppressWarnings(PMD.UnusedLocalVariable) Exception needs to be caught, but can't be used
  */
 public function __construct(Thrift\Transport\TTransport $flumeTransport, ThriftFlumeEventServerClient $client, $level = Logger::DEBUG, $bubble = true)
 {
     $this->client = $client;
     /*
      * Even if flume is away, the application should work. Thats why the exception is catched.
      */
     try {
         $flumeTransport->open();
     } catch (Thrift\Exception\TException $thriftException) {
         $this->handlingStopped = true;
     }
     parent::__construct($level, $bubble);
 }
 public function flush()
 {
     if (TStringFuncFactory::create()->strlen($this->wBuf_) > 0) {
         $this->transport_->write($this->wBuf_);
         $this->wBuf_ = '';
     }
     $this->transport_->flush();
 }
 public function flush()
 {
     if (TStringFuncFactory::create()->strlen($this->wBuf_) > 0) {
         $out = $this->wBuf_;
         // Note that we clear the internal wBuf_ prior to the underlying write
         // to ensure we're in a sane state (i.e. internal buffer cleaned)
         // if the underlying write throws up an exception
         $this->wBuf_ = '';
         $this->transport_->write($out);
     }
     $this->transport_->flush();
 }
 private function saslRead_($statusByte = false)
 {
     // Read SASL Header
     if ($statusByte) {
         $frame = unpack('Cstatus/Nlength', $this->transport_->readAll(5));
     } else {
         $frame = unpack('Nlength', $this->transport_->readAll(4));
     }
     // Read SASL Payload
     $frame['payload'] = $this->transport_->readAll($frame['length']);
     return $frame;
 }
Esempio n. 6
0
 /**
  * Writes the output buffer to the stream in the format of a 4-byte length
  * followed by the actual data.
  */
 public function flush()
 {
     if (!$this->write_ || TStringFuncFactory::create()->strlen($this->wBuf_) == 0) {
         return $this->transport_->flush();
     }
     if ($contextBuf = $this->writeContextSerialize()) {
         $this->wBuf_ = $contextBuf . $this->wBuf_;
     }
     // Note that we clear the internal wBuf_ prior to the underlying write
     // to ensure we're in a sane state (i.e. internal buffer cleaned)
     // if the underlying write throws up an exception
     $this->transport_->write(pack('N', TStringFuncFactory::create()->strlen($this->wBuf_)) . $this->wBuf_);
     $this->wBuf_ = '';
     $this->transport_->flush();
 }