Class: Gloo::App::RunningApp

Inherits:
Object
  • Object
show all
Defined in:
lib/gloo/app/running_app.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj, engine) ⇒ RunningApp

Set up the running app for the given object.



18
19
20
21
22
23
24
# File 'lib/gloo/app/running_app.rb', line 18

def initialize( obj, engine )
  @engine = engine
  @log = @engine.log
  @obj = obj

  @db_clients = {}
end

Instance Attribute Details

#db_timeObject (readonly)

Returns the value of attribute db_time.



13
14
15
# File 'lib/gloo/app/running_app.rb', line 13

def db_time
  @db_time
end

#objObject (readonly)

Returns the value of attribute obj.



13
14
15
# File 'lib/gloo/app/running_app.rb', line 13

def obj
  @obj
end

Instance Method Details

#add_db_time(time) ⇒ Object

Add the given time to the db time.



49
50
51
52
# File 'lib/gloo/app/running_app.rb', line 49

def add_db_time time
  @db_time = 0 unless @db_time
  @db_time += time
end

#cache_db_client(obj, client) ⇒ Object

Cache the given DB client for the given object.



69
70
71
# File 'lib/gloo/app/running_app.rb', line 69

def cache_db_client( obj, client )
  @db_clients[ obj.pn ] = client
end

#db_client_for_obj(obj) ⇒ Object

Get the DB client for the given object.



76
77
78
# File 'lib/gloo/app/running_app.rb', line 76

def db_client_for_obj( obj )
  return @db_clients[ obj.pn ]
end

#reset_db_timeObject

Reset the db time to zero



57
58
59
# File 'lib/gloo/app/running_app.rb', line 57

def reset_db_time
  @db_time = 0
end

#startObject

Start the running app.



28
29
30
31
# File 'lib/gloo/app/running_app.rb', line 28

def start
  obj.start
  @log.debug "running app started for #{@obj.pn}"
end

#stopObject

The running app has been stopped.



36
37
38
39
# File 'lib/gloo/app/running_app.rb', line 36

def stop
  obj.stop
  @log.debug "running app stopped for #{@obj.pn}"
end