Skip to content

Commit ce4fe75

Browse files
committed
Fix attar accessibility of @parent_core and @logger
1 parent 314a26d commit ce4fe75

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/concurrent/actress/core.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ module Actress
88
class Core
99
include TypeCheck
1010

11-
attr_reader :reference, :name, :path, :logger, :parent_core
12-
private :parent_core
11+
attr_reader :reference, :name, :path, :executor
1312

1413
# @option opts [String] name
1514
# @option opts [Reference, nil] parent of an actor spawning this one
@@ -49,8 +48,8 @@ def initialize(opts = {}, &block)
4948
@actress = actress_class.new *args, &block
5049
@actress.send :initialize_core, self
5150
rescue => ex
52-
puts "#{ex} (#{ex.class})\n#{ex.backtrace.join("\n")}"
53-
terminate! # TODO test this
51+
@logger.error ex
52+
terminate!
5453
end
5554
end
5655
end
@@ -109,10 +108,10 @@ def terminate!
109108
guard!
110109
@terminated.set
111110

112-
parent_core.remove_child reference if parent_core
111+
@parent_core.remove_child reference if @parent_core
113112
@mailbox.each do |envelope|
114113
reject_envelope envelope
115-
logger.debug "rejected #{envelope.message} from #{envelope.sender_path}"
114+
@logger.debug "rejected #{envelope.message} from #{envelope.sender_path}"
116115
end
117116
@mailbox.clear
118117
# TODO terminate all children
@@ -147,15 +146,15 @@ def receive_envelope
147146

148147
if terminated?
149148
reject_envelope envelope
150-
logger.fatal "this should not be happening #{caller[0]}"
149+
@logger.fatal "this should not be happening #{caller[0]}"
151150
end
152151

153-
logger.debug "received #{envelope.message} from #{envelope.sender_path}"
152+
@logger.debug "received #{envelope.message} from #{envelope.sender_path}"
154153

155154
result = @actress.on_envelope envelope
156155
envelope.ivar.set result unless envelope.ivar.nil?
157156
rescue => error
158-
logger.error error
157+
@logger.error error
159158
envelope.ivar.fail error unless envelope.ivar.nil?
160159
terminate!
161160
ensure
@@ -171,7 +170,7 @@ def schedule_execution
171170
Thread.current[:__current_actress__] = reference
172171
yield
173172
rescue => e
174-
logger.fatal e
173+
@logger.fatal e
175174
ensure
176175
Thread.current[:__current_actress__] = nil
177176
end

0 commit comments

Comments
 (0)