Class: LS4::HTTPGatewayService::Responder

Inherits:
Object
  • Object
show all
Defined in:
lib/ls4/service/gw_http.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponder

Returns a new instance of Responder.



739
740
741
742
743
744
745
# File 'lib/ls4/service/gw_http.rb', line 739

def initialize
	@mutex = Mutex.new
	@cond = ConditionVariable.new
	@sent = false
	@retval = nil
	@err = nil
end

Instance Attribute Details

#errObject (readonly)

Returns the value of attribute err.



748
749
750
# File 'lib/ls4/service/gw_http.rb', line 748

def err
  @err
end

#retvalObject (readonly)

Returns the value of attribute retval.



747
748
749
# File 'lib/ls4/service/gw_http.rb', line 747

def retval
  @retval
end

Instance Method Details

#error(err, retval = nil) ⇒ Object



774
775
776
# File 'lib/ls4/service/gw_http.rb', line 774

def error(err, retval = nil)
	result(retval, err)
end

#result(retval, err = nil) ⇒ Object



762
763
764
765
766
767
768
769
770
771
772
# File 'lib/ls4/service/gw_http.rb', line 762

def result(retval, err=nil)
	@mutex.synchronize do
		unless @sent
			@retval = retval
			@err = err
			@sent = true
			@cond.signal
		end
	end
	nil
end

#sent?Boolean

Returns:

  • (Boolean)


758
759
760
# File 'lib/ls4/service/gw_http.rb', line 758

def sent?
	@sent
end

#waitObject



750
751
752
753
754
755
756
# File 'lib/ls4/service/gw_http.rb', line 750

def wait
	@mutex.synchronize do
		until @sent
			@cond.wait(@mutex)
		end
	end
end