Class: Hjc::JarJob
- Inherits:
-
Object
- Object
- Hjc::JarJob
- Defined in:
- lib/hjc/jar_job.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#jar_args ⇒ Object
Returns the value of attribute jar_args.
-
#jar_file ⇒ Object
Returns the value of attribute jar_file.
-
#main_class ⇒ Object
Returns the value of attribute main_class.
Instance Method Summary collapse
-
#initialize ⇒ JarJob
constructor
A new instance of JarJob.
- #run ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize ⇒ JarJob
Returns a new instance of JarJob.
5 6 |
# File 'lib/hjc/jar_job.rb', line 5 def initialize end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
3 4 5 |
# File 'lib/hjc/jar_job.rb', line 3 def args @args end |
#jar_args ⇒ Object
Returns the value of attribute jar_args.
3 4 5 |
# File 'lib/hjc/jar_job.rb', line 3 def jar_args @jar_args end |
#jar_file ⇒ Object
Returns the value of attribute jar_file.
3 4 5 |
# File 'lib/hjc/jar_job.rb', line 3 def jar_file @jar_file end |
#main_class ⇒ Object
Returns the value of attribute main_class.
3 4 5 |
# File 'lib/hjc/jar_job.rb', line 3 def main_class @main_class end |
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/hjc/jar_job.rb', line 8 def run # jar_urls = Util.hadoop_jars.map {|jar| URL.new('file://' + jar)} # cl = URLClassLoader.new(jar_urls.to_java(URL)) # java.lang.Thread.current_thread.set_context_class_loader(cl) # org.apache.hadoop.examples.ExampleDriver.main(['pi', '1', '10']) target_class = eval(@main_class) @ret = target_class.main(@jar_args) end |
#success? ⇒ Boolean
17 18 19 |
# File 'lib/hjc/jar_job.rb', line 17 def success? @ret == 0 end |