Skip to content

Commit 493ec53

Browse files
committed
Merge pull request #319 from ruby-concurrency/internal-reorg-concerns
Moved mixins to the `Concern` module
2 parents 626aa46 + 7aeb681 commit 493ec53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+919
-895
lines changed

lib/concurrent/actor.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require 'concurrent/configuration'
22
require 'concurrent/executor/serialized_execution'
3-
require 'concurrent/logging'
43
require 'concurrent/synchronization'
54
require 'concurrent/edge/future'
65

lib/concurrent/actor/behaviour/abstract.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
require 'concurrent/concern/logging'
2+
13
module Concurrent
24
module Actor
35
module Behaviour
46
class Abstract
57
include TypeCheck
68
include InternalDelegations
9+
include Concern::Logging
710

811
attr_reader :core, :subsequent
912

@@ -39,7 +42,7 @@ def broadcast(public, event)
3942
def reject_envelope(envelope)
4043
envelope.reject! ActorTerminated.new(reference)
4144
dead_letter_routing << envelope unless envelope.future
42-
log Logging::DEBUG, "rejected #{envelope.message} from #{envelope.sender_path}"
45+
log DEBUG, "rejected #{envelope.message} from #{envelope.sender_path}"
4346
end
4447
end
4548
end

lib/concurrent/actor/behaviour/sets_results.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ def on_envelope(envelope)
1414
result = pass envelope
1515
if result != MESSAGE_PROCESSED && !envelope.future.nil?
1616
envelope.future.success result
17-
log Logging::DEBUG, "finished processing of #{envelope.message.inspect}"
17+
log DEBUG, "finished processing of #{envelope.message.inspect}"
1818
end
1919
nil
2020
rescue => error
21-
log Logging::ERROR, error
21+
log ERROR, error
2222
case error_strategy
2323
when :terminate!
2424
terminate!

lib/concurrent/actor/context.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'concurrent/concern/logging'
2+
13
module Concurrent
24
module Actor
35

@@ -22,6 +24,7 @@ module Actor
2224
class AbstractContext
2325
include TypeCheck
2426
include InternalDelegations
27+
include Concern::Logging
2528

2629
attr_reader :core
2730

lib/concurrent/actor/core.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'concurrent/concern/logging'
12
require 'concurrent/executors'
23

34
module Concurrent
@@ -11,7 +12,7 @@ module Actor
1112
# that would eat up all threads in task pool and deadlock
1213
class Core < Synchronization::Object
1314
include TypeCheck
14-
include Concurrent::Logging
15+
include Concern::Logging
1516

1617
# @!attribute [r] reference
1718
# Reference to this actor which can be safely passed around.
@@ -44,7 +45,7 @@ class Core < Synchronization::Object
4445
# @option opts [CompletableFuture, nil] initialized, if present it'll be set or failed after {Context} initialization
4546
# @option opts [Reference, nil] parent **private api** parent of the actor (the one spawning )
4647
# @option opts [Proc, nil] logger a proc accepting (level, progname, message = nil, &block) params,
47-
# can be used to hook actor instance to any logging system, see {Concurrent::Logging}
48+
# can be used to hook actor instance to any logging system, see {Concurrent::Concern::Logging}
4849
# @param [Proc] block for class instantiation
4950
def initialize(opts = {}, &block)
5051
super(&nil)
@@ -127,7 +128,7 @@ def schedule_execution
127128
end
128129

129130
def broadcast(public, event)
130-
log Logging::DEBUG, "event: #{event.inspect} (#{public ? 'public' : 'private'})"
131+
log DEBUG, "event: #{event.inspect} (#{public ? 'public' : 'private'})"
131132
@first_behaviour.on_event(public, event)
132133
end
133134

lib/concurrent/actor/default_dead_letter_handler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Concurrent
22
module Actor
33
class DefaultDeadLetterHandler < RestartingContext
44
def on_message(dead_letter)
5-
log Logging::INFO, "got dead letter #{dead_letter.inspect}"
5+
log INFO, "got dead letter #{dead_letter.inspect}"
66
end
77
end
88
end

lib/concurrent/agent.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
require 'thread'
2-
require 'concurrent/dereferenceable'
3-
require 'concurrent/observable'
4-
require 'concurrent/logging'
2+
require 'concurrent/concern/dereferenceable'
3+
require 'concurrent/concern/observable'
4+
require 'concurrent/concern/logging'
55
require 'concurrent/executor/executor'
6-
require 'concurrent/utility/deprecation'
6+
require 'concurrent/concern/deprecation'
77

88
module Concurrent
99

@@ -79,10 +79,10 @@ module Concurrent
7979
# @!attribute [r] timeout
8080
# @return [Fixnum] the maximum number of seconds before an update is cancelled
8181
class Agent
82-
include Dereferenceable
83-
include Observable
84-
include Logging
85-
include Deprecation
82+
include Concern::Dereferenceable
83+
include Concern::Observable
84+
include Concern::Logging
85+
include Concern::Deprecation
8686

8787
attr_reader :timeout, :io_executor, :fast_executor
8888

lib/concurrent/async.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ module Concurrent
7979
# horn.async.echo('one') # asynchronous, non-blocking, thread-safe
8080
# horn.await.echo('two') # synchronous, blocking, thread-safe
8181
#
82-
# @see Concurrent::Obligation
82+
# @see Concurrent::Concern::Obligation
8383
# @see Concurrent::IVar
8484
module Async
8585

lib/concurrent/atom.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'concurrent/dereferenceable'
1+
require 'concurrent/concern/dereferenceable'
22
require 'concurrent/atomic/atomic_reference'
33
require 'concurrent/synchronization/object'
44

@@ -22,7 +22,7 @@ module Concurrent
2222
#
2323
# @see http://clojure.org/atoms Clojure Atoms
2424
class Atom < Synchronization::Object
25-
include Dereferenceable
25+
include Concern::Dereferenceable
2626

2727
# Create a new atom with the given initial value.
2828
#

lib/concurrent/atomic/condition.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require 'concurrent/utility/monotonic_time'
2-
require 'concurrent/utility/deprecation'
2+
require 'concurrent/concern/deprecation'
33

44
module Concurrent
55

@@ -15,7 +15,7 @@ module Concurrent
1515
#
1616
# @deprecated
1717
class Condition
18-
include Deprecation
18+
include Concern::Deprecation
1919

2020
class Result
2121
def initialize(remaining_time)

0 commit comments

Comments
 (0)