Follow these steps to implement the example:
- Create a class named MyScheduledTask parameterized by a generic type named V. It extends the FutureTask class and implements the RunnableScheduledFuture interface:
public class MyScheduledTask<V> extends FutureTask<V> implements RunnableScheduledFuture<V> {
- Declare a privateRunnableScheduledFuture attribute named task:
private RunnableScheduledFuture<V> task;
- Declare a privateScheduledThreadPoolExecutor class named executor:
private ScheduledThreadPoolExecutor executor;
- Declare a private long attribute named period:
private long period;
- Declare a private long attribute named startDate:
private long startDate;
- Implement a constructor of the class. It receives ...