Class: VertxShell::Job
- Inherits:
-
Object
- Object
- VertxShell::Job
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb
Overview
A job executed in a JobController, grouping one or several process.
The job life cycle can be controlled with the #run, #resume and #suspend and #interrupt
methods.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (Fixnum) id
The job id.
-
- (true, false) interrupt
Attempt to interrupt the job.
-
- (Fixnum) lastStopped
When the job was last stopped.
-
- (String) line
The execution line of the job, i.e the shell command line that launched this job.
-
- (::VertxShell::Process) process
The first process in the job.
-
- (self) resume(*args)
Resume the job.
-
- (self) run
Run the job, before running the job a must be set.
-
- (self) setSession(session)
Set a session on the job.
-
- (self) setTty(tty)
Set a tty on the job.
-
- (:READY, ...) status
The job exec status.
-
- (self) statusUpdateHandler(handler) { ... }
Set an handler called when the job terminates.
-
- (self) suspend
Resume the job.
-
- (void) terminate
Terminate the job.
-
- (self) toBackground
Send the job to background.
-
- (self) toForeground
Send the job to foreground.
Class Method Details
+ (Boolean) accept?(obj)
24 25 26 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 24 def @@j_api_type.accept?(obj) obj.class == Job end |
+ (Object) j_api_type
33 34 35 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 33 def self.j_api_type @@j_api_type end |
+ (Object) j_class
36 37 38 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 36 def self.j_class Java::IoVertxExtShellSystem::Job.java_class end |
+ (Object) unwrap(obj)
30 31 32 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 30 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
27 28 29 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 27 def @@j_api_type.wrap(obj) Job.new(obj) end |
Instance Method Details
- (Fixnum) id
Returns the job id
211 212 213 214 215 216 217 218 219 220 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 211 def id if !block_given? return @j_del.java_method(:id, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling id()" end end |
- (true, false) interrupt
Attempt to interrupt the job.
157 158 159 160 161 162 163 164 165 166 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 157 def interrupt? if !block_given? return @j_del.java_method(:interrupt, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling interrupt?()" end end |
- (Fixnum) lastStopped
Returns when the job was last stopped
114 115 116 117 118 119 120 121 122 123 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 114 def last_stopped if !block_given? return @j_del.java_method(:lastStopped, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling last_stopped()" end end |
- (String) line
Returns the execution line of the job, i.e the shell command line that launched this job
88 89 90 91 92 93 94 95 96 97 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 88 def line if !block_given? return @j_del.java_method(:line, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling line()" end end |
- (::VertxShell::Process) process
Returns the first process in the job
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 73 def process if !block_given? if @cached_process != nil return @cached_process end return @cached_process = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:process, []).call(),::VertxShell::Process) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling process()" end end |
- (self) resume - (self) resume(foreground)
Resume the job.
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 58 def resume(*args) if !block_given? && args[0] == nil return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:resume, []).call(),::VertxShell::Job) elsif (args[0].class == TrueClass || args[0].class == FalseClass) && !block_given? @j_del.java_method(:resume, [Java::boolean.java_class]).call(args[0]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling resume(#{args[0]})" end end |
- (self) run
Run the job, before running the job a must be set.
101 102 103 104 105 106 107 108 109 110 111 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 101 def run if !block_given? @j_del.java_method(:run, []).call() return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling run()" end end |
- (self) setSession(session)
Set a session on the job.
198 199 200 201 202 203 204 205 206 207 208 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 198 def set_session(*args) if args[0].class.method_defined?(:j_del) && !block_given? @j_del.java_method(:setSession, [Java::IoVertxExtShellSession::Session.java_class]).call(args[0].j_del) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_session(#{args[0]})" end end |
- (self) setTty(tty)
Set a tty on the job.
143 144 145 146 147 148 149 150 151 152 153 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 143 def set_tty(*args) if args[0].class.method_defined?(:j_del) && !block_given? @j_del.java_method(:setTty, [Java::IoVertxExtShellTerm::Tty.java_class]).call(args[0].j_del) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_tty(#{args[0]})" end end |
- (:READY, ...) status
Returns the job exec status
237 238 239 240 241 242 243 244 245 246 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 237 def status if !block_given? return @j_del.java_method(:status, []).call().name.intern end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling status()" end end |
- (self) statusUpdateHandler(handler) { ... }
Set an handler called when the job terminates.
128 129 130 131 132 133 134 135 136 137 138 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 128 def status_update_handler if true @j_del.java_method(:statusUpdateHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event.name.intern) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling status_update_handler()" end end |
- (self) suspend
Resume the job.
42 43 44 45 46 47 48 49 50 51 52 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 42 def suspend if !block_given? @j_del.java_method(:suspend, []).call() return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling suspend()" end end |
- (void) terminate
This method returns an undefined value.
Terminate the job.
170 171 172 173 174 175 176 177 178 179 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 170 def terminate if !block_given? return @j_del.java_method(:terminate, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling terminate()" end end |
- (self) toBackground
Send the job to background.
183 184 185 186 187 188 189 190 191 192 193 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 183 def to_background if !block_given? @j_del.java_method(:toBackground, []).call() return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling to_background()" end end |
- (self) toForeground
Send the job to foreground.
224 225 226 227 228 229 230 231 232 233 234 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/job.rb', line 224 def to_foreground if !block_given? @j_del.java_method(:toForeground, []).call() return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling to_foreground()" end end |