[Groonga-commit] droonga/droonga-engine at 789696c [master] Forbid to forward after shutdown

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Apr 1 19:23:50 JST 2015


YUKI Hiroshi	2015-04-01 19:23:50 +0900 (Wed, 01 Apr 2015)

  New Revision: 789696c3d8faf18434b5e5be4c8c580e52365e3f
  https://github.com/droonga/droonga-engine/commit/789696c3d8faf18434b5e5be4c8c580e52365e3f

  Message:
    Forbid to forward after shutdown

  Modified files:
    lib/droonga/forwarder.rb

  Modified: lib/droonga/forwarder.rb (+6 -0)
===================================================================
--- lib/droonga/forwarder.rb    2015-04-01 19:15:37 +0900 (569cdd4)
+++ lib/droonga/forwarder.rb    2015-04-01 19:23:50 +0900 (fe0c155)
@@ -23,9 +23,13 @@ module Droonga
   class Forwarder
     include Loggable
 
+    class AlreadyShutdown < Error
+    end
+
     def initialize(loop, options={})
       @loop = loop
       @senders = {}
+      @shutting_down = false
     end
 
     def start
@@ -35,6 +39,7 @@ module Droonga
 
     def shutdown
       logger.trace("shutdown: start")
+      @shutting_down = true
       @senders.each_value do |sender|
         sender.shutdown
       end
@@ -43,6 +48,7 @@ module Droonga
 
     def forward(message, destination)
       logger.trace("forward: start")
+      raise AlreadyShutdown.new if @shutting_down
       command = destination["type"]
       receiver = destination["to"]
       arguments = destination["arguments"]
-------------- next part --------------
HTML����������������������������...
Descargar 



More information about the Groonga-commit mailing list
Back to archive index