Class: AWS::Core::Http::CurbHandler
- Inherits:
-
Object
- Object
- AWS::Core::Http::CurbHandler
- Defined in:
- lib/aws/core/http/curb_handler.rb
Instance Method Summary collapse
- #handle(request, response) ⇒ Object
-
#initialize ⇒ CurbHandler
constructor
A new instance of CurbHandler.
Constructor Details
#initialize ⇒ CurbHandler
Returns a new instance of CurbHandler.
23 24 25 26 27 28 29 |
# File 'lib/aws/core/http/curb_handler.rb', line 23 def initialize @q = [] @sem = Mutex.new @multi = Curl::Multi.new start_processor end |
Instance Method Details
#handle(request, response) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/aws/core/http/curb_handler.rb', line 31 def handle request, response raise "unsupport http reqest method: #{request.http_method}" unless ['GET', 'HEAD', 'PUT', 'POST', 'DELETE'].include? request.http_method @sem.synchronize do @q << [request, response, Thread.current] begin @processor.wakeup rescue ThreadError start_processor end end Thread.stop nil end |