Class: Trinidad::Lifecycle::Host::RollingReload::Takeover

Inherits:
Base
  • Object
show all
Defined in:
lib/trinidad/lifecycle/host/rolling_reload.rb

Overview

:nodoc

Instance Method Summary collapse

Methods inherited from Base

#after_destroy, #after_init, #after_stop, #before_destroy, #before_init, #before_start, #before_stop, #configure_start, #configure_stop, #lifecycleEvent, #periodic, #start, #stop

Constructor Details

#initialize(context) ⇒ Takeover

Returns a new instance of Takeover.



45
46
47
# File 'lib/trinidad/lifecycle/host/rolling_reload.rb', line 45

def initialize(context)
  @old_context = context
end

Instance Method Details

#after_start(event) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/trinidad/lifecycle/host/rolling_reload.rb', line 49

def after_start(event)
  new_context = event.lifecycle
  new_context.remove_lifecycle_listener(self) # GC old context

  logger.debug "Stoping the old Context for [#{@old_context.path}]"

  @old_context.stop
  @old_context.destroy
  # NOTE: name might not be changed once added to a parent
  new_context.name = @old_context.name
  super
end