Uber | Implement ScheduledExecutorService

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2019-07-23Added By Anonymous
Source: Link

Company: Uber
Role: unknown
Interview Stage: unknown
Location: unknown
Year: unknown

Original Post Content:

Implement following method of ScheduledExecutorService interface in Java

public class ScheduledExecutorService {

/**
* Creates and executes a one-shot action that becomes enabled after the given delay.
*/
public void schedule(Runnable command, long delay, TimeUnit unit) {
}

/**
* Creates and executes a periodic action that becomes enabled first after the given initial delay, and
* subsequently with the given period; that is executions will commence after initialDelay then
* initialDelay+period, then initialDelay + 2 * period, and so on.
*/
public void scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) {
}

/*
* Creates and executes a periodic action that becomes enabled first after the given initial delay, and
* subsequently with the given delay between the termination of one execution and the commencement of the next.
*/
public void scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) {
}

}

Comments