Class: GlobalService

Inherits:
Application show all
Defined in:
lib/appswarm/global_service.rb

Instance Attribute Summary

Attributes inherited from Application

#cluster, #running

Instance Method Summary collapse

Methods inherited from Application

#appswarmBaseDir, #config, #getApp, #getAppDataPath, #getAppDataPaths, #getAppDataWritePath, #getAppDir, getAppDir, #getAppId, #getAppName, #getService, #info, #log, #monitor, protect, provides, #provides?, providing, #providingAPIs, #quit, #quit?, requirements, requires, #retrieveConfig, #shortName, #startup, #warning, #withApp, #withAppFork

Constructor Details

#initialize(cluster, options, name) ⇒ GlobalService

Returns a new instance of GlobalService.



7
8
9
10
11
# File 'lib/appswarm/global_service.rb', line 7

def initialize(cluster,options,name)
  super(cluster,options)
  @name=name
  provides(name)
end

Instance Method Details

#cronObject



34
35
36
# File 'lib/appswarm/global_service.rb', line 34

def cron
  
end

#cronTimeObject



12
13
14
# File 'lib/appswarm/global_service.rb', line 12

def cronTime
  @options[:cronTime]||10
end

#runObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/appswarm/global_service.rb', line 20

def run
  loop do
    begin
      cron
    rescue Object=>e
      log e
      log e.backtrace if e.is_a?(Exception)
    end
    sleep(cronTime)
  end
end

#serviceIDObject



16
17
18
# File 'lib/appswarm/global_service.rb', line 16

def serviceID
  GlobalServiceID.new(@name,self.class.to_s,providingAPIs)
end

#stopObject



31
32
33
# File 'lib/appswarm/global_service.rb', line 31

def stop
  
end