Class: Thrift::TOutboundStream
- Inherits:
-
TBaseStream
- Object
- TBaseStream
- Thrift::TOutboundStream
- Defined in:
- lib/thrift/outbound_stream.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(iprot, oprot, name, seqid, klass, message_type, unlock = nil) ⇒ TOutboundStream
constructor
A new instance of TOutboundStream.
- #ready ⇒ Object
- #send(arg) ⇒ Object
Constructor Details
#initialize(iprot, oprot, name, seqid, klass, message_type, unlock = nil) ⇒ TOutboundStream
Returns a new instance of TOutboundStream.
3 4 5 6 7 8 |
# File 'lib/thrift/outbound_stream.rb', line 3 def initialize(iprot, oprot, name, seqid, klass, , unlock = nil) @message_type = @klass = klass @unlock = unlock super(iprot, oprot, name, seqid) end |
Instance Method Details
#close ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/thrift/outbound_stream.rb', line 15 def close wait_ready write_shell @message_type + 1 @mutex.synchronize do loop do @cond.wait(@mutex) return nil if @closed end end end |
#ready ⇒ Object
10 11 12 13 |
# File 'lib/thrift/outbound_stream.rb', line 10 def ready Thread.new { read_goaway } super end |
#send(arg) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/thrift/outbound_stream.rb', line 29 def send(arg) raise EOFError if @closed unless @oprot.trans.open? mark_as_closed raise EOFError end wait_ready write @message_type, @klass.new(arg: arg) end |