package de.mklinger.commons.exec;

public class PingRunnable extends ErrorHandlingRunnable {
	private final Pingable pingable;

	public PingRunnable(final Pingable pingable) {
		this.pingable = pingable;
	}

	@Override
	public void doRun() {
		while (true) {
			if (Thread.currentThread().isInterrupted()) {
				return;
			}
			pingable.ping();
			if (Thread.currentThread().isInterrupted()) {
				return;
			}
			try {
				Thread.sleep(500);
			} catch (final InterruptedException e) {
				// we expect to be interrupted when done.
				Thread.currentThread().interrupt();
				return;
			}
		}
	}

	public void interrupt() {
		Thread.currentThread().interrupt();
	}
}

@@ -89,16 +89,48 @@
 able %7B%0D%0A
+%09private Thread runningThread;%0D%0A
 %09private
@@ -278,16 +278,59 @@
 un() %7B%0D%0A
+%09%09runningThread = Thread.currentThread();%0D%0A
 %09%09while 
@@ -725,38 +725,29 @@
 () %7B%0D%0A%09%09
-Thread.current
+running
 Thread
-()
 .interru

Fix thread interruption. Wrong thread was interrupted.