public final class MyClass {
private Connection connection;
public Example(Connection c){
this.connection = c;
}
public interface ConnectionWorker{
void doSomething(Connection conn);
}
public void work(ConnectionWorker worker){
worker.doSomething(connection);
}
}
(A) Example can be subclassed in order to specialize the implementation of MyClass.work(ConnectionWorker)
(B) Specialization is achieved through implementation of a ConnectionWorker
(C) The call to worker.doSomething must be synchronized on worker
(D) worker.doSomething must launch a worker thread passing conn and then wait with Thread join