Browse Source

code simplification [ci skip]

Sebastian Stenzel 9 years ago
parent
commit
8280bfe10a

+ 7 - 10
main/filesystem-invariants-tests/src/test/java/org/cryptomator/filesystem/invariants/ConcurrencyTests.java

@@ -89,17 +89,14 @@ public class ConcurrencyTests {
 
 
 		private final SynchronousQueue<Runnable> handoverQueue = new SynchronousQueue<>();
 		private final SynchronousQueue<Runnable> handoverQueue = new SynchronousQueue<>();
 		private final Thread thread = new Thread(() -> {
 		private final Thread thread = new Thread(() -> {
-			Runnable task;
-			while (true) {
-				try {
-					task = handoverQueue.take();
-				} catch (InterruptedException e) {
-					return;
-				}
-				if (task == TERMINATION_HINT) {
-					break;
+			try {
+				Runnable task;
+				while ((task = handoverQueue.take()) != TERMINATION_HINT) {
+					task.run();
 				}
 				}
-				task.run();
+			} catch (InterruptedException e) {
+				Thread.currentThread().interrupt();
+				return;
 			}
 			}
 		});
 		});