Java 8 RunnableScheduledFuture - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 RunnableScheduledFuture class.

This code example shows how to use the following methods:isDone
        return futureTask.isCancelled();
    } 
 
    @Override 
    public boolean isDone() { 
        return futureTask.isDone();
    } 
 
    @Override 
    public V get() throws InterruptedException, ExecutionException {
        return futureTask.get();
    } 
 
    @Override 
    public V get(long timeout, TimeUnit unit) throws InterruptedException,
            ExecutionException, TimeoutException {
        return futureTask.get(timeout, unit);
    } 
 
    @Override 
3
CodeRank
This code example shows how to use the following methods:getDelay, isPeriodic
	 * @param unit TimeUnit to return the result 
	 */ 
	@Override 
	public long getDelay(TimeUnit unit) {
		if (!isPeriodic()) { 
			return task.getDelay(unit);
		} else { 
			if (startDate==0){
				return task.getDelay(unit);
			} else { 
				Date now=new Date();
				long delay=startDate-now.getTime();
				return unit.convert(delay, TimeUnit.MILLISECONDS);
			} 
		} 
	} 
 
	/** 
	 * Method to compare two tasks. It calls the compareTo() method of the original task 
	 */ 

4
CodeRank
See Code Examples for Java 8 RunnableScheduledFuture Methods: