rt/emul/compact/src/main/java/java/util/concurrent/Callable.java
changeset 772 d382dacfd73f
parent 601 5198affdb915
child 1891 c8af252ea9eb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/rt/emul/compact/src/main/java/java/util/concurrent/Callable.java	Tue Feb 26 16:54:16 2013 +0100
     1.3 @@ -0,0 +1,65 @@
     1.4 +/*
     1.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.6 + *
     1.7 + * This code is free software; you can redistribute it and/or modify it
     1.8 + * under the terms of the GNU General Public License version 2 only, as
     1.9 + * published by the Free Software Foundation.  Oracle designates this
    1.10 + * particular file as subject to the "Classpath" exception as provided
    1.11 + * by Oracle in the LICENSE file that accompanied this code.
    1.12 + *
    1.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 + * version 2 for more details (a copy is included in the LICENSE file that
    1.17 + * accompanied this code).
    1.18 + *
    1.19 + * You should have received a copy of the GNU General Public License version
    1.20 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 + *
    1.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 + * or visit www.oracle.com if you need additional information or have any
    1.25 + * questions.
    1.26 + */
    1.27 +
    1.28 +/*
    1.29 + * This file is available under and governed by the GNU General Public
    1.30 + * License version 2 only, as published by the Free Software Foundation.
    1.31 + * However, the following notice accompanied the original version of this
    1.32 + * file:
    1.33 + *
    1.34 + * Written by Doug Lea with assistance from members of JCP JSR-166
    1.35 + * Expert Group and released to the public domain, as explained at
    1.36 + * http://creativecommons.org/publicdomain/zero/1.0/
    1.37 + */
    1.38 +
    1.39 +package java.util.concurrent;
    1.40 +
    1.41 +/**
    1.42 + * A task that returns a result and may throw an exception.
    1.43 + * Implementors define a single method with no arguments called
    1.44 + * <tt>call</tt>.
    1.45 + *
    1.46 + * <p>The <tt>Callable</tt> interface is similar to {@link
    1.47 + * java.lang.Runnable}, in that both are designed for classes whose
    1.48 + * instances are potentially executed by another thread.  A
    1.49 + * <tt>Runnable</tt>, however, does not return a result and cannot
    1.50 + * throw a checked exception.
    1.51 + *
    1.52 + * <p> The {@link Executors} class contains utility methods to
    1.53 + * convert from other common forms to <tt>Callable</tt> classes.
    1.54 + *
    1.55 + * @see Executor
    1.56 + * @since 1.5
    1.57 + * @author Doug Lea
    1.58 + * @param <V> the result type of method <tt>call</tt>
    1.59 + */
    1.60 +public interface Callable<V> {
    1.61 +    /**
    1.62 +     * Computes a result, or throws an exception if unable to do so.
    1.63 +     *
    1.64 +     * @return computed result
    1.65 +     * @throws Exception if unable to compute a result
    1.66 +     */
    1.67 +    V call() throws Exception;
    1.68 +}