aboutsummaryrefslogtreecommitdiffstats
path: root/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java
diff options
context:
space:
mode:
Diffstat (limited to 'context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java')
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java
index dca72391a..9e23175fb 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java
@@ -102,19 +102,27 @@ public class ConcurrentContextJvmThread implements Runnable, Closeable {
LOGGER.info(line);
}
- // Wait to get exit value
- try {
- final int exitValue = process.waitFor();
- LOGGER.info("\n\nJVM " + jvm + " finished, exit value is " + exitValue);
- } catch (final InterruptedException e) {
- LOGGER.warn("Thread was interrupted");
- Thread.currentThread().interrupt();
- }
+ waitForExitValue();
+
} catch (final Exception ioException) {
LOGGER.error("Error occured while writing JVM Output for command ", ioException);
}
}
+ /**
+ * Wait for an exit value from the the JVM.
+ */
+ private void waitForExitValue() {
+ // Wait to get exit value
+ try {
+ final int exitValue = process.waitFor();
+ LOGGER.info("\n\nJVM " + jvm + " finished, exit value is " + exitValue);
+ } catch (final InterruptedException e) {
+ LOGGER.warn("Thread was interrupted");
+ Thread.currentThread().interrupt();
+ }
+ }
+
@Override
public void close() {