Class: TestKafka::JavaRunner
- Inherits:
-
Object
- Object
- TestKafka::JavaRunner
- Defined in:
- lib/test_kafka/java_runner.rb
Constant Summary collapse
- MAX_HEAP_SIZE =
512
- JAR_PATTERNS =
[ # Some Kafka builds from 0.8.0: "core/target/scala-*/*.jar", # 0.8.1+ "libexec/core/build/**/*.jar" ]
Instance Attribute Summary collapse
-
#java_class ⇒ Object
readonly
Returns the value of attribute java_class.
-
#kafka_path ⇒ Object
readonly
Returns the value of attribute kafka_path.
-
#tmp_dir ⇒ Object
readonly
Returns the value of attribute tmp_dir.
Instance Method Summary collapse
-
#initialize(id, tmp_dir, java_class, port, kafka_path, properties = {}) ⇒ JavaRunner
constructor
A new instance of JavaRunner.
- #pid ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #with_interruption ⇒ Object
Constructor Details
#initialize(id, tmp_dir, java_class, port, kafka_path, properties = {}) ⇒ JavaRunner
Returns a new instance of JavaRunner.
15 16 17 18 19 20 21 22 |
# File 'lib/test_kafka/java_runner.rb', line 15 def initialize(id, tmp_dir, java_class, port, kafka_path, properties={}) @id = id @tmp_dir = tmp_dir @java_class = java_class @port = port @kafka_path = kafka_path @properties = properties end |
Instance Attribute Details
#java_class ⇒ Object (readonly)
Returns the value of attribute java_class.
24 25 26 |
# File 'lib/test_kafka/java_runner.rb', line 24 def java_class @java_class end |
#kafka_path ⇒ Object (readonly)
Returns the value of attribute kafka_path.
24 25 26 |
# File 'lib/test_kafka/java_runner.rb', line 24 def kafka_path @kafka_path end |
#tmp_dir ⇒ Object (readonly)
Returns the value of attribute tmp_dir.
24 25 26 |
# File 'lib/test_kafka/java_runner.rb', line 24 def tmp_dir @tmp_dir end |
Instance Method Details
#pid ⇒ Object
44 45 46 47 48 |
# File 'lib/test_kafka/java_runner.rb', line 44 def pid data = File.read(pid_path) data.to_i if data end |
#start ⇒ Object
26 27 28 29 |
# File 'lib/test_kafka/java_runner.rb', line 26 def start write_properties run end |
#stop ⇒ Object
31 32 33 |
# File 'lib/test_kafka/java_runner.rb', line 31 def stop daemon_controller.stop end |
#with_interruption ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/test_kafka/java_runner.rb', line 35 def with_interruption stop begin yield ensure start end end |