Module: Mailbox
- Includes:
- Synchronized
- Defined in:
- lib/mailbox.rb,
lib/daemon_thread_factory.rb
Defined Under Namespace
Modules: ClassMethods Classes: DaemonThreadFactory
Class Attribute Summary collapse
-
.raise_exceptions_immediately ⇒ Object
Used to tell
Mailbox
that allmailslot
methods should be run on the calling thread. -
.synchronous ⇒ Object
Used to tell
Mailbox
that allmailslot
methods should be run on the calling thread.
Instance Method Summary collapse
- #__queue_depth__ ⇒ Object
- #__thread_name__ ⇒ Object
- #dispose ⇒ Object
-
#register_channel(channel_name, channel) ⇒ Object
Register your jretlang channel as a named channel.
- #verbose_output_to(method_name) ⇒ Object
Class Attribute Details
.raise_exceptions_immediately ⇒ Object
Used to tell Mailbox
that all mailslot
methods should be run on the calling thread.
*** Intended for synchronous unit testing of concurrent apps***
41 42 43 |
# File 'lib/mailbox.rb', line 41 def raise_exceptions_immediately @raise_exceptions_immediately end |
.synchronous ⇒ Object
Used to tell Mailbox
that all mailslot
methods should be run on the calling thread.
*** Intended for synchronous unit testing of concurrent apps***
41 42 43 |
# File 'lib/mailbox.rb', line 41 def synchronous @synchronous end |
Instance Method Details
#__queue_depth__ ⇒ Object
55 56 57 |
# File 'lib/mailbox.rb', line 55 def __queue_depth__ __queue_counter__.get end |
#__thread_name__ ⇒ Object
59 60 61 |
# File 'lib/mailbox.rb', line 59 def __thread_name__ @__thread_name__ ||= "#{self.class.name} #{self.object_id} Mailbox" end |
#dispose ⇒ Object
32 33 34 |
# File 'lib/mailbox.rb', line 32 def dispose __fiber__.dispose end |
#register_channel(channel_name, channel) ⇒ Object
Register your jretlang channel as a named channel
21 22 23 24 25 26 |
# File 'lib/mailbox.rb', line 21 def register_channel(channel_name, channel) channel_registry = self.class.__channel_registry__ channel_registry.select { |k,v| v[:channel] == channel_name }.each do |k,v| v[:replyable] ? __subscribe_with_single_reply__(channel, k) : __subscribe__(channel, k) end end |
#verbose_output_to(method_name) ⇒ Object
28 29 30 |
# File 'lib/mailbox.rb', line 28 def verbose_output_to method_name @__verbose_target__ = method_name end |