Class: GameMachine::Actor::System

Inherits:
Object
  • Object
show all
Defined in:
server/lib/game_machine/actor/system.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, config_str) ⇒ System

Returns a new instance of System


7
8
9
10
# File 'server/lib/game_machine/actor/system.rb', line 7

def initialize(name,config_str)
  @config_str = config_str
  @name = name
end

Instance Attribute Details

#actor_systemObject (readonly)

Returns the value of attribute actor_system


6
7
8
# File 'server/lib/game_machine/actor/system.rb', line 6

def actor_system
  @actor_system
end

#nameObject (readonly)

Returns the value of attribute name


6
7
8
# File 'server/lib/game_machine/actor/system.rb', line 6

def name
  @name
end

Instance Method Details

#addressObject


12
13
14
# File 'server/lib/game_machine/actor/system.rb', line 12

def address
  actor_system.to_string
end

#configObject


16
17
18
19
# File 'server/lib/game_machine/actor/system.rb', line 16

def config
  @config ||= JavaLib::ConfigFactory.parseString(@config_str).
    getConfig(name).withFallback(JavaLib::ConfigFactory.load)
end

#create!Object


21
22
23
# File 'server/lib/game_machine/actor/system.rb', line 21

def create!
  @actor_system ||= JavaLib::ActorSystem.create(name, config)
end

#shutdown!Object


25
26
27
28
# File 'server/lib/game_machine/actor/system.rb', line 25

def shutdown!
  actor_system.shutdown
  actor_system.await_termination
end