Skip to content

Commit f069a04

Browse files
committed
Extract ObjectSleeper.sleep() method to make it reusable (e.g. in metafacture-fix). (#559)
1 parent 7b6e932 commit f069a04

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

metafacture-flowcontrol/src/main/java/org/metafacture/flowcontrol/ObjectSleeper.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,22 @@ public long getSleepTime() {
6565
return sleepTime;
6666
}
6767

68-
@Override
69-
public void process(final T obj) {
68+
/**
69+
* Sleeps for the specified amount of time.
70+
*/
71+
public void sleep() {
7072
try {
7173
Thread.sleep(sleepTime);
7274
}
7375
catch (final InterruptedException e) {
7476
Thread.currentThread().interrupt();
7577
throw new MetafactureException(e.getMessage(), e);
7678
}
79+
}
80+
81+
@Override
82+
public void process(final T obj) {
83+
sleep();
7784
getReceiver().process(obj);
7885
}
7986

0 commit comments

Comments
 (0)