class RIMS::ServerResponseSubscriber

Public Class Methods

new(channel, pub) click to toggle source

do not call this method directly, call the following method instead.

- ServerResponseChannel#make_pub_sub_pair
# File lib/rims/channel.rb, line 117
def initialize(channel, pub)
  @channel = channel
  @pub = pub
  @queue = Thread::Queue.new
end

Public Instance Methods

detach() click to toggle source
# File lib/rims/channel.rb, line 134
def detach
  @channel.detach(self)
  nil
end
fetch() { |response_message| ... } click to toggle source
# File lib/rims/channel.rb, line 143
def fetch
  while (message?)
    response_message = @queue.pop(true)
    yield(response_message)
  end

  nil
end
idle_interrupt() click to toggle source
# File lib/rims/channel.rb, line 171
def idle_interrupt
  @queue.push(nil)
  nil
end
idle_wait() { |message_list| ... } click to toggle source
# File lib/rims/channel.rb, line 152
def idle_wait
  catch(:idle_interrupt) {
    while (response_message = @queue.pop(false))
      message_list = [ response_message ]
      fetch{|next_response_message|
        if (next_response_message) then
          message_list << next_response_message
        else
          yield(message_list)
          throw(:idle_interrupt)
        end
      }
      yield(message_list)
    end
  }

  nil
end
message?() click to toggle source
# File lib/rims/channel.rb, line 139
def message?
  ! @queue.empty?
end
publish(response_message) click to toggle source

do not call this method directly, call the following method instead.

- ServerResponsePublisher#publish
# File lib/rims/channel.rb, line 129
def publish(response_message)
  @queue.push(response_message)
  nil
end