Here you can find the source of isRegularlyDone(Future> future)
Parameter | Description |
---|---|
future | the Future to test for regularly completion. |
static boolean isRegularlyDone(Future<?> future)
//package com.java2s; /*//from ww w. j a v a2 s . c o m * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This file is part of SequentialExecutorService. * * SequentialExecutorService contains non-parallel implementations * for Java's ExecutorService and ScheduledExecutorService. * Copyright (C) 2015 Matthias Johannes Reimchen * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; public class Main { /** * Checks if the specified {@link Future} terminated regularly, e.g. * without throwing an Exception. * * @param future the Future to test for regularly completion. * @return false if and only if calling {@link Future#get()} throws an * exception. */ static boolean isRegularlyDone(Future<?> future) { try { future.get(); } catch (InterruptedException | ExecutionException e) { return false; } return true; } }