From d3ae1cc497ab89caf16c1061c44cf5d2e51f990d Mon Sep 17 00:00:00 2001 From: Speiger Date: Tue, 5 Nov 2024 14:03:52 +0100 Subject: [PATCH] Updated Process Listener for things that made sense to do. --- .../jaffree/process/ProcessListener.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/github/kokorin/jaffree/process/ProcessListener.java b/src/main/java/com/github/kokorin/jaffree/process/ProcessListener.java index 1a219271..279009cb 100644 --- a/src/main/java/com/github/kokorin/jaffree/process/ProcessListener.java +++ b/src/main/java/com/github/kokorin/jaffree/process/ProcessListener.java @@ -8,8 +8,17 @@ * @author Speiger */ public interface ProcessListener { - public void onStart(Process process); - public void onStop(Process process); + /** + * Provides the Process instance that was started + * @param process the process + */ + void onStart(Process process); + + /** + * Provides the Process instance that was just completed + * @param process the process + */ + void onStop(Process process); /** * Simple tracker wrapper that allows to track all instances being loaded. @@ -17,7 +26,7 @@ public interface ProcessListener { * @param instances Set. Highly Suggest {@link Collections#newSetFromMap} using a {@link ConcurrentHashMap} for multithreading support * @return ProcessListener wrapper */ - public static ProcessListener of(Set instances) { + static ProcessListener of(Set instances) { return new Impl(instances); } @@ -27,12 +36,12 @@ static class Impl implements ProcessListener { public Impl(Set instances) { this.instances = instances; } - + @Override public void onStart(Process process) { instances.add(process); } - + @Override public void onStop(Process process) { instances.remove(process);