class TaskJuggler::ReportServerRecord

This class stores the information about a ReportServer that was created by the ProjectServer.

Attributes

authKey[RW]
tag[R]
uri[RW]

Public Class Methods

new(tag) click to toggle source
# File lib/taskjuggler/daemon/ProjectServer.rb, line 418
def initialize(tag)
  # A random tag to uniquely identify the entry.
  @tag = tag
  # The URI of the ReportServer process.
  @uri = nil
  # The authentication key of the ReportServer.
  @authKey = nil
  # The DRbObject of the ReportServer.
  @reportServer = nil
end

Public Instance Methods

ping() click to toggle source

Send a ping to the ReportServer process to check that it is still functioning properly. If not, it has probably terminated and we can remove it from the list of active ReportServers.

# File lib/taskjuggler/daemon/ProjectServer.rb, line 432
def ping
  return true unless @uri

  debug('', "Sending ping to ReportServer #{@uri}")
  begin
    @reportServer = DRbObject.new(nil, @uri) unless @reportServer
    @reportServer.ping(@authKey)
  rescue => exception
    # TjRuntimeError exceptions are simply passed through.
    if exception.is_a?(TjRuntimeError)
      raise TjRuntimeError, $!
    end

    # ReportServer processes terminate on request of their clients. Not
    # responding to a ping is a normal event.
    debug('', "ReportServer (#{@uri}) has terminated")
    return false
  end
  true
end