(cherry picked from commit dab8ed8a3b)
This commit is contained in:
Noemi Szemenyei
2022-03-11 13:31:58 +01:00
parent 3c7555de36
commit e0e572a8b4
3 changed files with 85 additions and 73 deletions
@@ -20,4 +20,23 @@ public interface BackgroundExecutorWrapper {
*/
Runnable wrap(Runnable task);
/**
* Combines two wrappers by joining them.
*/
default BackgroundExecutorWrapper with(BackgroundExecutorWrapper inner) {
return new BackgroundExecutorWrapper() {
@Override
public Runnable wrap(Runnable task) {
return BackgroundExecutorWrapper.this.wrap(inner.wrap(task));
}
@Override
public <T> Callable<T> wrap(Callable<T> task) {
return BackgroundExecutorWrapper.this.wrap(inner.wrap(task));
}
};
}
}