Class: Hjc::JarJob

Inherits:
Object
  • Object
show all
Defined in:
lib/hjc/jar_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeJarJob

Returns a new instance of JarJob.



5
6
# File 'lib/hjc/jar_job.rb', line 5

def initialize
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



3
4
5
# File 'lib/hjc/jar_job.rb', line 3

def args
  @args
end

#jar_argsObject

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_fileObject

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_classObject

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

#runObject



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

Returns:

  • (Boolean)


17
18
19
# File 'lib/hjc/jar_job.rb', line 17

def success?
  @ret == 0
end