YUKI Hiroshi
yuki****@clear*****
Mon Dec 16 10:23:00 JST 2013
もしかしたら既に口頭でやりとり済みの話かもしれませんが、この文脈で originalという語を使うのは誤りというか不自然ではないかなあと思いました。 僕は「the original」というと、今まで世界のどこにもなかった・初めて世に出 たこの仕組みを実装したモジュール、すなわちFluentLoggerの事を真っ先に想起 します。 「our version」とか「custom」とかの言葉を自分だったら使いそうです。 Kouhei Sutou wrote: > Author > Kouhei Sutou <kou �� clear-code.com> > Date > 2013-12-13 19:02:14 +0900 (Fri, 13 Dec 2013) > New Revision > d9fb10ff6a09cfde4c903f7d669387cad1440cd7 > <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7> > Message > > Add original fluent message sender > > The original fluent message sender replaces > fluent-logger. fluent-logger is sync based fluent message sender. The > original fluent message sender is async based one. > > Should we send a pull request to fluent-logger for async > implementation? If other programs needs async implementation, we shold > do it. > > Added files > > * lib/droonga/fluent_message_sender.rb > <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#diff-2> > > Modified files > > * lib/droonga/dispatcher.rb > <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#diff-0> > * lib/droonga/event_loop.rb > <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#diff-1> > * lib/droonga/forwarder.rb > <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#diff-3> > * lib/droonga/handler.rb > <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#diff-4> > * lib/droonga/message_pusher.rb > <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#diff-5> > * lib/droonga/message_receiver.rb > <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#diff-6> > * lib/droonga/partition.rb > <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#diff-7> > * lib/droonga/processor.rb > <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#diff-8> > * lib/droonga/worker.rb > <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#diff-9> > > Modified: lib/droonga/dispatcher.rb (+7 -1) > =================================================================== > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L35> > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L38> > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L39> > > > 40 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L41> > 42 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L42> > 43 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L43> > 44 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L44> > 45 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L45> > > > > 46 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L46> > 47 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L47> > 48 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L48> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L49> > 50 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L50> > 51 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L51> > 52 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L52> > > > 53 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L53> > 54 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L54> > 55 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0L55> > > > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R35> > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R38> > > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R39> > 40 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R41> > 42 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R42> > 43 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R43> > 44 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R44> > 45 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R45> > 46 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R46> > 47 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R47> > 48 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R48> > 49 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R49> > 50 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R50> > 51 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R51> > 52 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R52> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R53> > 54 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R54> > 55 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R55> > 56 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R56> > 57 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R57> > 58 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R58> > 59 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R59> > 60 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R60> > 61 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L0R61> > > > > @@ -36,13 +36,17 @@module Droonga > @local = Regexp.new("^#{@name}") > @adapter = Adapter.new(self, > :adapters => Droonga.catalog.option("plugins")) > - @forwarder = Forwarder.new > + @loop = EventLoop.new > + @forwarder = Forwarder.new(@loop) > @distributor = Distributor.new(self, @options) > end > > def start > @forwarder.start > @farm.start > + @loop_thread = Thread.new do > + @loop.run > + end > end > > def shutdown > @@ -50,6 +54,8 @@module Droonga > @distributor.shutdown > @adapter.shutdown > @farm.shutdown > + @loop.stop > + @loop_thread.join > end > > def add_route(route) > > Modified: lib/droonga/event_loop.rb (+5 -1) > =================================================================== > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1L30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1L31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1L32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1L33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1L34> > > 35 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1L35> > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1L36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1L37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1L38> > > > > > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1L39> > 40 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1L40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1L41> > > > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R33> > > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R34> > 35 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R35> > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R38> > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R39> > 40 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R41> > 42 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R42> > 43 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R43> > 44 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R44> > 45 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L1R45> > > > > @@ -31,11 +31,15 @@module Droonga > > def stop > @loop.stop > - @loop_breaker.signal > + break_current_loop > end > > def attach(watcher) > @loop.attach(watcher) > + break_current_loop > + end > + > + def break_current_loop > @loop_breaker.signal > end > end > > Added: lib/droonga/fluent_message_sender.rb (+83 -0) 100644 > =================================================================== > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2L-1> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R0> > 1 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R1> > 2 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R2> > 3 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R3> > 4 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R4> > 5 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R5> > 6 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R6> > 7 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R7> > 8 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R8> > 9 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R9> > 10 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R10> > 11 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R11> > 12 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R12> > 13 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R13> > 14 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R14> > 15 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R15> > 16 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R16> > 17 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R17> > 18 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R19> > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R21> > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R22> > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R24> > 25 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R25> > 26 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R26> > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R27> > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R29> > 30 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R34> > 35 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R35> > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R38> > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R39> > 40 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R41> > 42 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R42> > 43 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R43> > 44 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R44> > 45 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R45> > 46 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R46> > 47 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R47> > 48 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R48> > 49 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R49> > 50 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R50> > 51 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R51> > 52 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R52> > 53 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R53> > 54 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R54> > 55 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R55> > 56 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R56> > 57 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R57> > 58 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R58> > 59 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R59> > 60 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R60> > 61 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R61> > 62 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R62> > 63 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R63> > 64 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R64> > 65 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R65> > 66 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R66> > 67 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R67> > 68 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R68> > 69 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R69> > 70 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R70> > 71 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R71> > 72 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R72> > 73 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R73> > 74 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R74> > 75 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R75> > 76 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R76> > 77 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R77> > 78 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R78> > 79 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R79> > 80 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R80> > 81 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R81> > 82 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R82> > 83 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L2R83> > > > > @@ -0,0 +1,83 @@ > +# -*- coding: utf-8 -*- > +# > +# Copyright (C) 2013 Droonga Project > +# > +# This library is free software; you can redistribute it and/or > +# modify it under the terms of the GNU Lesser General Public > +# License version 2.1 as published by the Free Software Foundation. > +# > +# This library is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > +# Lesser General Public License for more details. > +# > +# You should have received a copy of the GNU Lesser General Public > +# License along with this library; if not, write to the Free Software > +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > + > +require "cool.io" > + > +module Droonga > + class FluentMessageSender > + def initialize(loop, host, port) > + @loop = loop > + @host = host > + @port = port > + @shutdown = false > + end > + > + def start > + $log.trace("#{log_tag}: start: start") > + connect > + $log.trace("#{log_tag}: start: done") > + end > + > + def shutdown > + $log.trace("#{log_tag}: shutdown: start") > + @shutdown = true > + @socket.close unles****@socke*****? > + $log.trace("#{log_tag}: shutdown: done") > + end > + > + def send(tag, data) > + $log.trace("#{log_tag}: send: start") > + connect if****@socke*****? > + @socket.write([tag, Time.now.to_i, data].to_msgpack) > + @loop.break_current_loop > + $log.trace("#{log_tag}: send: done") > + end > + > + private > + def connect > + $log.trace("#{log_tag}: connect: start") > + > + log_write_complete = lambda do > + $log.trace("#{log_tag}: write completed") > + end > + log_connect = lambda do > + $log.trace("#{log_tag}: connected to #{@host}:#{@port}") > + end > + log_failed = lambda do > + $log.error("#{log_tag}: failed to connect to #{@host}:#{@port}") > + end > + > + @socket = Coolio::TCPSocket.connect(@host, @port) > + @socket.on_write_complete do > + log_write_complete.call > + end > + @socket.on_connect do > + log_connect.call > + end > + @socket.on_connect_failed do > + log_failed.call > + end > + @loop.attach(@socket) > + > + $log.trace("#{log_tag}: connect: done") > + end > + > + def log_tag > + "[#{Process.ppid}][#{Process.pid}] fluent-message-sender" > + end > + end > +end > > Modified: lib/droonga/forwarder.rb (+28 -34) > =================================================================== > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L14> > 15 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L15> > 16 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L16> > 17 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L17> > 18 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L19> > > > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L21> > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L22> > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L24> > > > > 25 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L25> > 26 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L26> > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L27> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L34> > 35 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L35> > > > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L38> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L61> > 62 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L62> > 63 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L63> > 64 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L64> > 65 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L65> > 66 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L66> > 67 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L67> > > > > 68 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L68> > 69 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L69> > 70 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L70> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L86> > 87 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L87> > 88 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L88> > 89 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L89> > 90 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L90> > > 91 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L91> > 92 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L92> > 93 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L93> > 94 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L94> > 95 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L95> > 96 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L96> > 97 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L97> > 98 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L98> > > > > > 99 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L99> > 100 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L100> > 101 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L101> > 102 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L102> > 103 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L103> > 104 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L104> > 105 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L105> > 106 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L106> > 107 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L107> > 108 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L108> > 109 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L109> > 110 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L110> > > > 111 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L111> > 112 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L112> > 113 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L113> > 114 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L114> > 115 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L115> > 116 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L116> > 117 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L117> > > > 118 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L118> > 119 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L119> > > > > > > 120 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L120> > 121 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L121> > 122 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L122> > 123 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L123> > > > > > 124 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L124> > 125 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L125> > 126 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3L126> > > > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R14> > 15 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R15> > 16 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R16> > 17 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R17> > > > 18 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R19> > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R21> > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R22> > > > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R24> > 25 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R25> > 26 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R26> > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R27> > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R28> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R34> > > > 35 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R35> > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R38> > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R39> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R62> > 63 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R63> > 64 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R64> > 65 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R65> > > > > 66 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R66> > 67 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R67> > 68 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R68> > 69 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R69> > 70 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R70> > 71 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R71> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R87> > 88 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R88> > 89 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R89> > 90 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R90> > > 91 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R91> > 92 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R92> > 93 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R93> > 94 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R94> > 95 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R95> > > > > > 96 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R96> > 97 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R97> > 98 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R98> > 99 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R99> > 100 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R100> > > > > > > > > > > > > 101 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R101> > 102 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R102> > 103 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R103> > > > > > > > 104 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R104> > 105 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R105> > 106 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R106> > > 107 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R107> > 108 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R108> > 109 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R109> > 110 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R110> > 111 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R111> > 112 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R112> > 113 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R113> > > > 114 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R114> > 115 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R115> > 116 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R116> > 117 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R117> > 118 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R118> > 119 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R119> > 120 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L3R120> > > > > @@ -15,13 +15,14 @@ > # License along with this library; if not, write to the Free Software > # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > > -require "fluent-logger" > -require "fluent/logger/fluent_logger" > +require "droonga/event_loop" > +require "droonga/fluent_message_sender" > > module Droonga > class Forwarder > - def initialize > - @outputs = {} > + def initialize(loop) > + @loop = loop > + @senders = {} > end > > def start > @@ -31,8 +32,8 @@module Droonga > > def shutdown > $log.trace("#{log_tag}: shutdown: start") > - @outputs.each do |dest, output| > - output[:logger].close if output[:logger] > + @senders.each_value do |sender| > + sender.shutdown > end > $log.trace("#{log_tag}: shutdown: done") > end > @@ -62,9 +63,9 @@module Droonga > port = $2 > tag = $3 > params = $4 > - output = get_output(host, port, params) > - unless output > - $log.trace("#{log_tag}: output: abort: no output", > + sender = find_sender(host, port, params) > + unless sender > + $log.trace("#{log_tag}: output: abort: no sender", > :host => host, > :port => port, > :params => params) > @@ -87,40 +88,33 @@module Droonga > output_tag = "#{tag}.message" > log_info = "<#{receiver}>:<#{output_tag}>" > $log.trace("#{log_tag}: output: post: start: #{log_info}") > - output.post(output_tag, message) > + sender.send(output_tag, message) > $log.trace("#{log_tag}: output: post: done: #{log_info}") > $log.trace("#{log_tag}: output: done") > end > > - def get_output(host, port, params) > - host_port = "#{host}:#{port}" > - @outputs[host_port] ||= {} > - output = @outputs[host_port] > + def find_sender(host, port, params) > + connection_id = extract_connection_id(params) > + destination = "#{host}:#{port}" > + destination << "?#{connection_id}" if connection_id > > - has_connection_id = (not params.nil? \ > - and params =~ /[\?&;]connection_id=([^&;]+)/) > - if output[:logger].nil? or has_connection_id > - connection_id = $1 > - if not has_connection_id or output[:connection_id] != connection_id > - output[:connection_id] = connection_id > - logger = create_logger(:host => host, :port => port.to_i) > - # output[:logger] should be closed if it exists beforehand? > - output[:logger] = logger > - end > - end > + @senders[destination] ||= create_sender(host, port) > + end > > - has_client_session_id = (not params.nil? \ > - and params =~ /[\?&;]client_session_id=([^&;]+)/) > - if has_client_session_id > - client_session_id = $1 > - # some generic way to handle client_session_id is expected > - end > + def extract_connection_id(params) > + return nil unless params > > - output[:logger] > + if /[\?&;]connection_id=([^&;]+)/ =~ params > + $1 > + else > + nil > + end > end > > - def create_logger(options) > - Fluent::Logger::FluentLogger.new(nil, options) > + def create_sender(host, port) > + sender = FluentMessageSender.new(@loop, host, port) > + sender.start > + sender > end > > def log_tag > > Modified: lib/droonga/handler.rb (+3 -2) > =================================================================== > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L26> > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L27> > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L29> > 30 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L30> > > > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L33> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L97> > 98 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L98> > 99 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L99> > 100 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L100> > 101 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L101> > > 102 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L102> > 103 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L103> > 104 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4L104> > > > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R26> > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R27> > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R29> > > 30 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R34> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R98> > 99 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R99> > 100 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R100> > 101 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R101> > > 102 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R102> > 103 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R103> > 104 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R104> > 105 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L4R105> > > > > @@ -27,7 +27,8 @@module Droonga > > attr_reader :context, :envelope, :name > > - def initialize(options={}) > + def initialize(loop, options={}) > + @loop = loop > @options = options > @name = options[:name] > @database_name = options[:database] > @@ -98,7 +99,7 @@module Droonga > @database =****@conte*****_database(@database_name) > end > load_plugins(@options[:handlers] || []) > - @forwarder = Forwarder.new > + @forwarder = Forwarder.new(@loop) > end > > def instantiate_plugin(name) > > Modified: lib/droonga/message_pusher.rb (+2 -9) > =================================================================== > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L16> > 17 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L17> > 18 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L19> > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L21> > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L22> > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L24> > 25 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L25> > 26 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L26> > > > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L27> > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L29> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L34> > 35 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L35> > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L38> > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L39> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L41> > 42 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L42> > 43 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L43> > 44 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L44> > 45 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L45> > 46 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L46> > 47 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L47> > 48 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5L48> > > > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R16> > 17 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R17> > 18 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R19> > > > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R21> > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R22> > > > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R24> > 25 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R25> > 26 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R26> > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R27> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R29> > 30 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R31> > > > > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R34> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R35> > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R38> > > > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R39> > 40 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L5R41> > > > > @@ -17,13 +17,11 @@ > > require "msgpack" > > -require "droonga/event_loop" > - > module Droonga > class MessagePusher > attr_reader :raw_receiver > - def initialize > - @loop = EventLoop.new > + def initialize(loop) > + @loop = loop > end > > def start(base_path) > @@ -31,9 +29,6 @@module Droonga > FileUtils.rm_f(socket_path) > @raw_receiver = UNIXServer.new(socket_path) > FileUtils.chmod(0600, socket_path) > - @loop_thread = Thread.new do > - @loop.run > - end > end > > def shutdown > @@ -41,8 +36,6 @@module Droonga > socket_path = @raw_receiver.path > @raw_receiver.close > FileUtils.rm_f(socket_path) > - @loop.stop > - @loop_thread.join > $log.trace("#{log_tag}: shutdown: done") > end > > > Modified: lib/droonga/message_receiver.rb (+7 -9) > =================================================================== > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L16> > 17 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L17> > 18 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L19> > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L21> > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L22> > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L24> > 25 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L25> > > > 26 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L26> > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L27> > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L29> > 30 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L34> > > > > > 35 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L35> > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L37> > > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L38> > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L39> > 40 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L41> > 42 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L42> > 43 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6L43> > > > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R16> > 17 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R17> > 18 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R19> > > > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R21> > > > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R22> > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R24> > 25 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R25> > 26 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R26> > > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R27> > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R29> > > > 30 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R34> > 35 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R35> > > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R38> > > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R39> > 40 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L6R41> > > > > @@ -17,27 +17,25 @@ > > require "msgpack" > > -require "droonga/event_loop" > - > module Droonga > class MessageReceiver > - def initialize(receiver, &callback) > - @loop = EventLoop.new > + def initialize(loop, receiver, &callback) > + @loop = loop > @receiver = Coolio::Server.new(receiver, Coolio::Socket) do |connection| > setup_receive_handler(connection) > end > - @loop.attach(@receiver) > @callback = callback > end > > - def run > - @loop.run > + def start > + $log.trace("#{log_tag}: start: start") > + @loop.attach(@receiver) > + $log.trace("#{log_tag}: start: done") > end > > - def stop > + def shutdown > $log.trace("#{log_tag}: shutdown: start") > @receiver.close > - @loop.stop > $log.trace("#{log_tag}: shutdown: done") > end > > > Modified: lib/droonga/partition.rb (+9 -2) > =================================================================== > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L19> > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L21> > > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L22> > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L24> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L26> > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L27> > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L29> > 30 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L31> > > > > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L34> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L38> > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L39> > > > > 40 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L41> > 42 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L42> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L44> > 45 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L45> > 46 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L46> > 47 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L47> > > > 48 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L48> > 49 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L49> > 50 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7L50> > > > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R19> > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R21> > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R22> > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R24> > 25 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R25> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R27> > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R29> > 30 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R30> > > > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R34> > 35 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R35> > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R36> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R38> > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R39> > 40 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R41> > 42 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R42> > 43 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R43> > 44 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R44> > 45 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R45> > 46 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R46> > 47 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R47> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R49> > 50 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R50> > 51 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R51> > 52 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R52> > 53 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R53> > 54 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R54> > 55 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R55> > 56 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R56> > 57 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L7R57> > > > > @@ -19,6 +19,7 @@require "serverengine" > > require "droonga/server" > require "droonga/worker" > +require "droonga/event_loop" > require "droonga/message_pusher" > require "droonga/processor" > > @@ -27,8 +28,9 @@module Droonga > def initialize(options={}) > @options = options > @n_workers = @options[:n_workers] || 0 > - @message_pusher = MessagePusher.new > - @processor = Processor.new(@message_pusher, @options) > + @loop = EventLoop.new > + @message_pusher = MessagePusher.new(@loop) > + @processor = Processor.new(@loop, @message_pusher, @options) > @supervisor = nil > end > > @@ -37,6 +39,9 @@module Droonga > @processor.start > base_path = @options[:database] > @message_pusher.start(base_path) > + @loop_thread = Thread.new do > + @loop.run > + end > start_supervisor if @n_workers > 0 > end > > @@ -45,6 +50,8 @@module Droonga > shutdown_supervisor if @supervisor > @message_pusher.shutdown > @processor.shutdown > + @loop.stop > + @loop_thread.join > $log.trace("partition: shutdown: done") > end > > > Modified: lib/droonga/processor.rb (+3 -2) > =================================================================== > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L19> > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L21> > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L22> > > > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L24> > 25 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L25> > 26 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L26> > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L27> > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L29> > > 30 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8L32> > > > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R19> > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R21> > > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R22> > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R24> > 25 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R25> > 26 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R26> > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R27> > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R29> > > 30 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L8R33> > > > > @@ -19,14 +19,15 @@require "droonga/handler" > > module Droonga > class Processor > - def initialize(message_pusher, options={}) > + def initialize(loop, message_pusher, options={}) > + @loop = loop > @message_pusher = message_pusher > @options = options > @n_workers = @options[:n_workers] || 0 > end > > def start > - @handler = Handler.new(@options) > + @handler = Handler.new(@loop, @options) > @handler.start > end > > > Modified: lib/droonga/worker.rb (+8 -4) > =================================================================== > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L14> > 15 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L15> > 16 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L16> > 17 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L17> > > 18 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L19> > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L21> > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L22> > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L24> > > > 25 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L25> > 26 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L26> > > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L27> > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L29> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L31> > 32 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L34> > > > 35 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L35> > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L38> > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L39> > 40 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L41> > > > 42 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L42> > 43 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L43> > 44 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9L44> > > > > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R14> > 15 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R15> > 16 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R16> > 17 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R17> > 18 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R18> > 19 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R19> > 20 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R20> > 21 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R21> > 22 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R22> > 23 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R23> > 24 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R24> > > 25 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R25> > 26 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R26> > 27 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R27> > > 28 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R28> > 29 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R29> > 30 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R30> > 31 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R31> > ... <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R32> > 33 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R33> > 34 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R34> > 35 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R35> > > 36 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R36> > 37 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R37> > 38 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R38> > 39 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R39> > 40 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R40> > 41 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R41> > 42 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R42> > 43 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R43> > > 44 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R44> > 45 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R45> > 46 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R46> > 47 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R47> > 48 <https://github.com/droonga/fluent-plugin-droonga/commit/d9fb10ff6a09cfde4c903f7d669387cad1440cd7#L9R48> > > > > @@ -15,15 +15,17 @@ > # License along with this library; if not, write to the Free Software > # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > > +require "droonga/event_loop" > require "droonga/handler" > require "droonga/message_receiver" > > module Droonga > module Worker > def initialize > - @handler = Handler.new(config) > + @loop = EventLoop.new > + @handler = Handler.new(@loop, config) > receiver_socket = config[:message_receiver] > - @message_receiver = MessageReceiver.new(receiver_socket) do |message| > + @message_receiver = MessageReceiver.new(@loop, receiver_socket) do |message| > process(message) > end > end > @@ -31,14 +33,16 @@module Droonga > def run > $log.trace("#{log_tag}: run: start") > @handler.start > - @message_receiver.run > + @message_receiver.start > + @loop.run > @handler.shutdown > $log.trace("#{log_tag}: run: done") > end > > def stop > $log.trace("#{log_tag}: stop: start") > - @message_receiver.stop > + @message_receiver.shutdown > + @loop.stop > $log.trace("#{log_tag}: stop: done") > end > > > > > _______________________________________________ > Groonga-commit mailing list > Groonga-commit �� lists.sourceforge.jp > http://lists.sourceforge.jp/mailman/listinfo/groonga-commit > -- 結城 洋志 <YUKI Hiroshi> E-mail: yuki �� clear-code.com 株式会社クリアコード 〒113-0033 東京都文京区本郷3-27-12 本郷デントビル2階 TEL : 03-6231-7270 FAX : 03-6231-7271 WWW : http://www.clear-code.com/