Class: GameMachine::ReloadableMonitor

Inherits:
Actor::Base
  • Object
show all
Defined in:
server/lib/game_machine/reloadable_monitor.rb

Constant Summary

Constants inherited from Actor::Base

Actor::Base::ON_RECEIVE_HOOKS

Instance Method Summary collapse

Methods inherited from Actor::Base

aspect, aspects, find, find_by_address, find_distributed, find_distributed_local, find_remote, hashring, local_path, logger, model_filter, #onReceive, player_controller, #receive_message, #schedule_message, #schedule_message_once, #sender, set_player_controller

Instance Method Details

#on_receive(message) ⇒ Object


15
16
17
18
19
# File 'server/lib/game_machine/reloadable_monitor.rb', line 15

def on_receive(message)
  if message == 'update_reloadable'
    update_reloadable
  end
end

#post_init(*args) ⇒ Object


4
5
6
7
8
9
# File 'server/lib/game_machine/reloadable_monitor.rb', line 4

def post_init(*args)
  @scheduler = get_context.system.scheduler
  @dispatcher = get_context.system.dispatcher
  update_interval = 2000
  schedule_update(update_interval)
end

#schedule_update(update_interval) ⇒ Object


21
22
23
24
# File 'server/lib/game_machine/reloadable_monitor.rb', line 21

def schedule_update(update_interval)
  duration = JavaLib::Duration.create(update_interval, java.util.concurrent.TimeUnit::MILLISECONDS)
  @scheduler.schedule(duration, duration, get_self, "update_reloadable", @dispatcher, nil)
end

#update_reloadableObject


11
12
13
# File 'server/lib/game_machine/reloadable_monitor.rb', line 11

def update_reloadable
  GameMachine::Actor::Reloadable.update_paths
end