Class: DRbQS::SendCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/drbqs/manage.rb

Constant Summary collapse

MAX_WAIT_TIME =
10

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ SendCommand

Returns a new instance of SendCommand.



8
9
10
# File 'lib/drbqs/manage.rb', line 8

def initialize(message)
  @message = message
end

Instance Method Details

#get_statusObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/drbqs/manage.rb', line 21

def get_status
  @message.write([:server, :request_status, get_hostname])
  i = 0
  loop do
    begin
      mes = @message.take([:status, String], 0)
      return mes[1]
    rescue Rinda::RequestExpiredError
      i += 1
      if i > MAX_WAIT_TIME
        return nil
      end
      sleep(1)
    end
  end
end

#send_exit_signalObject



17
18
19
# File 'lib/drbqs/manage.rb', line 17

def send_exit_signal
  @message.write([:server, :exit_server, get_hostname])
end