Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class Main {
    private static <T> T readCallableResult(Future<T> future) throws Exception {

        try {
            return future.get(60, TimeUnit.SECONDS);
        } catch (TimeoutException e) {
            return null;
        } finally {
            future.cancel(true);
        }

    }
}