Module: Mailbox::ClassMethods

Includes:
Synchronized::ClassMethods
Defined in:
lib/mailbox.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Synchronized::ClassMethods

#synchronized

Instance Attribute Details

#__channel_registry__Object

Used within Mailbox module



110
111
112
# File 'lib/mailbox.rb', line 110

def __channel_registry__
  @__channel_registry__
end

Instance Method Details

#__fiber_factory__Object



133
134
135
# File 'lib/mailbox.rb', line 133

def __fiber_factory__
  @__fiber_factory__ ||= nil
end

#mailbox_thread_pool_size(count) ⇒ Object



129
130
131
# File 'lib/mailbox.rb', line 129

def mailbox_thread_pool_size(count)
  @__fiber_factory__ = JRL::Fibers::PoolFiberFactory.new(JRL::Concurrent::Executors.new_fixed_thread_pool(count, DaemonThreadFactory.new))
end

#mailslot(params = {}) ⇒ Object

Notifies Mailbox that the next method added will be a mailslot. If :channel is provided the next method will become a subscriber on the channel. Channel based mailslot methods are also made private to discourage direct invocation. :exception can be provided as the symbol for a method to handle any exceptions that occur in your mailslot. This method will be passed the exception that was raised



120
121
122
123
124
125
126
127
# File 'lib/mailbox.rb', line 120

def mailslot(params={})
  @next_channel_name = params[:channel]
  @replyable = params[:replyable]
  @timeout = params[:timeout].nil? ? -1 : params[:timeout] * 1000
  @exception = params[:exception]

  @mailslot = true
end