Skip to content

Commit fa637f4

Browse files
committed
Minor cleanups
1 parent 3686738 commit fa637f4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/concurrent/edge/future.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def any(*futures)
106106
# @return [Future]
107107
def select(*channels)
108108
future do
109+
# noinspection RubyArgCount
109110
Channel.select do |s|
110111
channels.each do |ch|
111112
s.take(ch) { |value| [value, ch] }
@@ -514,9 +515,9 @@ def apply(block)
514515
# @!visibility private
515516
class PartiallyFailed < CompletedWithResult
516517
def initialize(value, reason)
518+
super()
517519
@Value = value
518520
@Reason = reason
519-
super()
520521
end
521522

522523
def success?
@@ -999,10 +1000,9 @@ class InnerPromise < AbstractPromise
9991000
# @!visibility private
10001001
class BlockedPromise < InnerPromise
10011002
def initialize(future, blocked_by_futures, countdown)
1003+
super(future)
10021004
initialize_blocked_by(blocked_by_futures)
10031005
@Countdown = AtomicFixnum.new countdown
1004-
1005-
super(future)
10061006
@BlockedBy.each { |f| f.add_callback :pr_callback_notify_blocked, self }
10071007
end
10081008

@@ -1066,6 +1066,7 @@ def initialize(blocked_by_future, default_executor, executor, &task)
10661066
raise ArgumentError, 'no block given' unless block_given?
10671067
@Executor = executor
10681068
@Task = task
1069+
# has to be after @Executor and @Task is set
10691070
super Future.new(self, default_executor), blocked_by_future, 1
10701071
end
10711072

@@ -1214,8 +1215,8 @@ def on_completable(done_future)
12141215
# @!visibility private
12151216
class ZipFutureEventPromise < BlockedPromise
12161217
def initialize(future, event, default_executor)
1217-
@FutureResult = future
12181218
super Future.new(self, default_executor), [future, event], 2
1219+
@FutureResult = future
12191220
end
12201221

12211222
def on_completable(done_future)
@@ -1226,9 +1227,9 @@ def on_completable(done_future)
12261227
# @!visibility private
12271228
class ZipFutureFuturePromise < BlockedPromise
12281229
def initialize(future1, future2, default_executor)
1230+
super Future.new(self, default_executor), [future1, future2], 2
12291231
@Future1Result = future1
12301232
@Future2Result = future2
1231-
super Future.new(self, default_executor), [future1, future2], 2
12321233
end
12331234

12341235
def on_completable(done_future)
@@ -1357,8 +1358,8 @@ def touch
13571358
private
13581359

13591360
def initialize(default_executor, value)
1360-
@Value = value
13611361
super Future.new(self, default_executor)
1362+
@Value = value
13621363
end
13631364
end
13641365

@@ -1376,6 +1377,8 @@ def inspect
13761377
private
13771378

13781379
def initialize(default_executor, intended_time)
1380+
super Event.new(self, default_executor)
1381+
13791382
@IntendedTime = intended_time
13801383

13811384
in_seconds = begin
@@ -1388,8 +1391,6 @@ def initialize(default_executor, intended_time)
13881391
[0, schedule_time.to_f - now.to_f].max
13891392
end
13901393

1391-
super Event.new(self, default_executor)
1392-
13931394
Concurrent.global_timer_set.post(in_seconds) do
13941395
@Future.complete_with Event::COMPLETED
13951396
end

0 commit comments

Comments
 (0)