@@ -45,15 +45,15 @@ module Concurrent
45
45
#
46
46
# @example Basic usage
47
47
# task = Concurrent::TimerTask.new{ puts 'Boom!' }
48
- # task.run!
48
+ # task.execute
49
49
#
50
50
# task.execution_interval #=> 60 (default)
51
51
# task.timeout_interval #=> 30 (default)
52
52
#
53
53
# # wait 60 seconds...
54
54
# #=> 'Boom!'
55
55
#
56
- # task.stop #=> true
56
+ # task.shutdown #=> true
57
57
#
58
58
# @example Configuring `:execution_interval` and `:timeout_interval`
59
59
# task = Concurrent::TimerTask.new(execution_interval: 5, timeout_interval: 5) do
@@ -65,7 +65,7 @@ module Concurrent
65
65
#
66
66
# @example Immediate execution with `:run_now`
67
67
# task = Concurrent::TimerTask.new(run_now: true){ puts 'Boom!' }
68
- # task.run!
68
+ # task.execute
69
69
#
70
70
# #=> 'Boom!'
71
71
#
@@ -75,7 +75,7 @@ module Concurrent
75
75
# execution_interval: 5
76
76
# ){ Time.now }
77
77
#
78
- # task.run!
78
+ # task.execute
79
79
# Time.now #=> 2013-11-07 18:06:50 -0500
80
80
# sleep(10)
81
81
# task.value #=> 2013-11-07 18:06:55 -0500
@@ -87,11 +87,11 @@ module Concurrent
87
87
# task.execution_interval += 1
88
88
# if task.execution_interval > 5
89
89
# puts 'Stopping...'
90
- # task.stop
90
+ # task.shutdown
91
91
# end
92
92
# end
93
93
#
94
- # timer_task.run # blocking call - this task will stop itself
94
+ # timer_task.execute # blocking call - this task will stop itself
95
95
# #=> Boom!
96
96
# #=> Boom! Boom!
97
97
# #=> Boom! Boom! Boom!
@@ -114,30 +114,30 @@ module Concurrent
114
114
#
115
115
# task = Concurrent::TimerTask.new(execution_interval: 1, timeout_interval: 1){ 42 }
116
116
# task.add_observer(TaskObserver.new)
117
- # task.run!
117
+ # task.execute
118
118
#
119
119
# #=> (2013-10-13 19:08:58 -0400) Execution successfully returned 42
120
120
# #=> (2013-10-13 19:08:59 -0400) Execution successfully returned 42
121
121
# #=> (2013-10-13 19:09:00 -0400) Execution successfully returned 42
122
- # task.stop
122
+ # task.shutdown
123
123
#
124
124
# task = Concurrent::TimerTask.new(execution_interval: 1, timeout_interval: 1){ sleep }
125
125
# task.add_observer(TaskObserver.new)
126
- # task.run!
126
+ # task.execute
127
127
#
128
128
# #=> (2013-10-13 19:07:25 -0400) Execution timed out
129
129
# #=> (2013-10-13 19:07:27 -0400) Execution timed out
130
130
# #=> (2013-10-13 19:07:29 -0400) Execution timed out
131
- # task.stop
131
+ # task.shutdown
132
132
#
133
133
# task = Concurrent::TimerTask.new(execution_interval: 1){ raise StandardError }
134
134
# task.add_observer(TaskObserver.new)
135
- # task.run!
135
+ # task.execute
136
136
#
137
137
# #=> (2013-10-13 19:09:37 -0400) Execution failed with error StandardError
138
138
# #=> (2013-10-13 19:09:38 -0400) Execution failed with error StandardError
139
139
# #=> (2013-10-13 19:09:39 -0400) Execution failed with error StandardError
140
- # task.stop
140
+ # task.shutdown
141
141
#
142
142
# @see http://ruby-doc.org/stdlib-2.0/libdoc/observer/rdoc/Observable.html
143
143
# @see http://docs.oracle.com/javase/7/docs/api/java/util/TimerTask.html
@@ -316,7 +316,7 @@ def schedule_next_task(interval = execution_interval)
316
316
# @!visibility private
317
317
def execute_task ( completion )
318
318
return unless @running . true?
319
- Concurrent ::timer ( timeout_interval , completion , &method ( :timeout_task ) )
319
+ Concurrent ::timer ( execution_interval , completion , &method ( :timeout_task ) )
320
320
success , value , reason = @executor . execute ( self )
321
321
if completion . try?
322
322
self . value = value
0 commit comments