Sha256: 77255fbcd1b5f7205ed170b0a9ed33476442b6b77d150e069e55bed06742c771

Contents?: true

Size: 1.03 KB

Versions: 35

Compression:

Stored size: 1.03 KB

Contents

module Concurrent
  module Actor
    module Behaviour
      class Supervising < Abstract
        def initialize(core, subsequent, handle, strategy)
          super core, subsequent
          @handle   = Match! handle, :terminate!, :resume!, :reset!, :restart!
          @strategy = case @handle
                      when :terminate!
                        Match! strategy, nil
                      when :resume!
                        Match! strategy, :one_for_one
                      when :reset!, :restart!
                        Match! strategy, :one_for_one, :one_for_all
                      end
        end

        def on_envelope(envelope)
          case envelope.message
          when Exception, :paused
            receivers = if @strategy == :one_for_all
                          children
                        else
                          [envelope.sender]
                        end
            receivers.each { |ch| ch << @handle }
          else
            pass envelope
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
concurrent-ruby-0.8.0 lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.8.0-java lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.2 lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.2-x86_64-linux lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.2-x86-solaris-2.11 lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.2-x86-mingw32 lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.2-x86-linux lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.2-x64-mingw32 lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.2-java lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.8.0.pre2 lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.8.0.pre2-java lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.8.0.pre1 lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.8.0.pre1-java lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.1 lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.1-x86_64-linux lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.1-x86-solaris-2.11 lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.1-x86-mingw32 lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.1-x86-linux lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.1-x64-mingw32 lib/concurrent/actor/behaviour/supervising.rb
concurrent-ruby-0.7.1-java lib/concurrent/actor/behaviour/supervising.rb