Skip to content
Snippets Groups Projects
Commit 3496ee31 authored by Christian Wulf's avatar Christian Wulf
Browse files

minor refactoring

parent 2a93485a
No related branches found
No related tags found
No related merge requests found
...@@ -38,14 +38,7 @@ public final class RoundRobinStrategy2 implements IDistributorStrategy { ...@@ -38,14 +38,7 @@ public final class RoundRobinStrategy2 implements IDistributorStrategy {
success = outputPort.sendNonBlocking(element); success = outputPort.sendNonBlocking(element);
if (0 == numLoops) { if (0 == numLoops) {
numWaits++; numWaits++;
// Thread.yield(); backoff();
try {
Thread.sleep(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
numLoops = numOutputPorts; numLoops = numOutputPorts;
} }
numLoops--; numLoops--;
...@@ -54,6 +47,16 @@ public final class RoundRobinStrategy2 implements IDistributorStrategy { ...@@ -54,6 +47,16 @@ public final class RoundRobinStrategy2 implements IDistributorStrategy {
return true; return true;
} }
private void backoff() {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Thread.yield();
}
private <T> OutputPort<T> getNextPortInRoundRobinOrder(final OutputPort<T>[] outputPorts) { private <T> OutputPort<T> getNextPortInRoundRobinOrder(final OutputPort<T>[] outputPorts) {
final OutputPort<T> outputPort = outputPorts[this.index]; final OutputPort<T> outputPort = outputPorts[this.index];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment