Skip to content

Commit 41c31ff

Browse files
committed
changed Synchronization methods from private to protected.
1 parent 3c32888 commit 41c31ff

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed

lib/concurrent/executor/executor_service.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class AbstractExecutorService < Synchronization::Object
1313

1414
attr_reader :fallback_policy
1515

16-
def initialize
17-
super()
16+
def initialize(*args, &block)
17+
super
1818
end
1919

2020
# @!macro [attach] executor_service_method_running_question
@@ -172,12 +172,11 @@ def terminate_at_exit
172172

173173
class RubyExecutorService < AbstractExecutorService
174174

175-
def initialize
176-
super()
177-
synchronize do
178-
@stop_event = Event.new
179-
@stopped_event = Event.new
180-
end
175+
def initialize(*args, &block)
176+
super
177+
@stop_event = Event.new
178+
@stopped_event = Event.new
179+
ensure_ivar_visibility!
181180
end
182181

183182
def post(*args, &task)
@@ -249,8 +248,8 @@ class JavaExecutorService < AbstractExecutorService
249248
}.freeze
250249
private_constant :FALLBACK_POLICY_CLASSES
251250

252-
def initialize
253-
super()
251+
def initialize(*args, &block)
252+
super
254253
end
255254

256255
def post(*args, &task)

lib/concurrent/synchronization/abstract_object.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def initialize(*args, &block)
3232
raise NotImplementedError
3333
end
3434

35-
private
35+
protected
3636

3737
# @yield runs the block synchronized against this object,
3838
# equivalent of java's `synchronize(this) {}`

lib/concurrent/synchronization/java_pure_object.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def initialize(*args, &block)
99
synchronize { ns_initialize(*args, &block) }
1010
end
1111

12-
private
12+
protected
1313

1414
def synchronize
1515
JRuby.reference0(self).synchronized { yield }

lib/concurrent/synchronization/monitor_object.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def initialize(*args, &block)
77
synchronize { ns_initialize(*args, &block) }
88
end
99

10-
private
10+
protected
1111

1212
def synchronize
1313
@__lock__.synchronize { yield }

lib/concurrent/synchronization/mutex_object.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def initialize(*args, &block)
77
synchronize { ns_initialize(*args, &block) }
88
end
99

10-
private
10+
protected
1111

1212
def synchronize
1313
if @__lock__.owned?

lib/concurrent/synchronization/rbx_object.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def initialize(*args, &block)
99
end
1010
end
1111

12-
private
12+
protected
1313

1414
def synchronize(&block)
1515
Rubinius.synchronize(self, &block)

0 commit comments

Comments
 (0)