Add Split and Merge functions to CLI

Create CanellableRunnable abstraction
Change Split/Merge implementation to CanellableRunnable
This commit is contained in:
Dmitry Isaenko 2020-07-13 00:16:44 +03:00
parent 3592c9086b
commit dbb7c8e2e1
19 changed files with 358 additions and 65 deletions

View file

@ -18,6 +18,7 @@
*/
package nsusbloader.COM.NET;
import nsusbloader.ModelControllers.CancellableRunnable;
import nsusbloader.ModelControllers.ILogPrinter;
import nsusbloader.NSLDataTypes.EFileStatus;
import nsusbloader.ModelControllers.Log;
@ -31,7 +32,7 @@ import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.*;
public class NETCommunications implements Runnable {
public class NETCommunications extends CancellableRunnable {
private final ILogPrinter logPrinter;
@ -84,7 +85,7 @@ public class NETCommunications implements Runnable {
@Override
public void run() {
if (! isValid || Thread.interrupted() )
if (! isValid || isCancelled() )
return;
logPrinter.print("\tStart chain", EMsgType.INFO);
@ -175,7 +176,7 @@ public class NETCommunications implements Runnable {
}
}
catch (Exception e){
if (Thread.interrupted())
if (isCancelled())
logPrinter.print("Interrupted by user.", EMsgType.INFO);
else
logPrinter.print(e.getMessage(), EMsgType.INFO);