Class TaskJuggler::ReportServerRecord
In: lib/taskjuggler/daemon/ProjectServer.rb
Parent: Object

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

Methods

new   ping  

Included Modules

MessageHandler

Attributes

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

Public Class methods

[Source]

# File lib/taskjuggler/daemon/ProjectServer.rb, line 415
    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

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.

[Source]

# File lib/taskjuggler/daemon/ProjectServer.rb, line 429
    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

[Validate]