Skip to content

Commit

Permalink
Minor refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorC committed Nov 10, 2018
1 parent 77a089a commit d53b771
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
10 changes: 8 additions & 2 deletions src/main/java/net/viktorc/pp4j/impl/AbstractProcessExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ private void startListeningToProcess(BufferedReader reader, boolean standard) {
}
}
}
} catch (IOException | InterruptedException e) {
} catch (IOException e) {
throw new ProcessException(e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ProcessException(e);
} finally {
termSemaphore.release();
Expand Down Expand Up @@ -315,7 +318,10 @@ protected boolean execute(Submission<?> submission, boolean terminateProcessAfte
public boolean execute(Submission<?> submission) {
try {
return execute(submission, false);
} catch (IOException | InterruptedException e) {
} catch (IOException e) {
throw new ProcessException(e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ProcessException(e);
}
}
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/net/viktorc/pp4j/impl/JavaProcessPoolExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,11 @@ public <T extends Serializable, S extends Callable<T> & Serializable> Future<T>
public void execute(Runnable command) {
try {
submit(command).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
} catch (ExecutionException e) {
throw new ProcessException(e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ProcessException(e);
}
}
@Override
Expand Down Expand Up @@ -289,9 +292,7 @@ public ProcessManager newProcessManager() {
for (URL url : urlClassLoader.getURLs()) {
try {
classPathEntries.add(Paths.get(url.toURI()).toAbsolutePath().toString());
} catch (FileSystemNotFoundException e){
continue;
} catch (URISyntaxException e) {
} catch (FileSystemNotFoundException | URISyntaxException e) {
continue;
}
}
Expand Down Expand Up @@ -416,7 +417,7 @@ private static class JavaSubmission<T extends Serializable, S extends Callable<T
/**
* Creates a submission for the specified {@link java.util.concurrent.Callable}.
*
* @param runnablePart The runnablePart to execute.
* @param task The task to execute.
* @throws IOException If the encoding of the serialized runnablePart fails.
* @throws NotSerializableException If some object to be serialized does not implement the
* {@link java.io.Serializable} interface.
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/net/viktorc/pp4j/impl/ProcessPoolExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,10 @@ public boolean execute(Submission<?> submission) {
try {
submit(submission).get();
return true;
} catch (InterruptedException | ExecutionException e) {
} catch (ExecutionException e) {
throw new ProcessException(e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ProcessException(e);
}
}
Expand Down

0 comments on commit d53b771

Please sign in to comment.