Seven Jobs That Throw
interface Job {
void run();
void pause();
void resume();
void progress(ProgressSink sink);
}
final class VacuumTablesJob implements Job {
public void run() { /* 40 minutes of DDL, not interruptible */ }
public void pause() { throw new UnsupportedOperationException(); }
public void resume() { throw new UnsupportedOperationException(); }
public void progress(ProgressSink s) { /* nothing to report */ }
}
There are 11 implementations of Job. Seven of them throw from pause and resume. The team proposes splitting the interface into Job { run(); progress(); } and PausableJob extends Job { pause(); resume(); }.
Which principle does that split most directly serve, and what disappears first?
Sign in to answer questions and track your progress
Sign In