rt/emul/compact/src/main/java/java/security/PrivilegedExceptionAction.java
author Jaroslav Tulach <jtulach@netbeans.org>
Thu, 03 Oct 2013 15:40:35 +0200
branchjdk7-b147
changeset 1334 588d5bf7a560
permissions -rw-r--r--
Set of JDK classes needed to run javac
jtulach@1334
     1
/*
jtulach@1334
     2
 * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
jtulach@1334
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jtulach@1334
     4
 *
jtulach@1334
     5
 * This code is free software; you can redistribute it and/or modify it
jtulach@1334
     6
 * under the terms of the GNU General Public License version 2 only, as
jtulach@1334
     7
 * published by the Free Software Foundation.  Oracle designates this
jtulach@1334
     8
 * particular file as subject to the "Classpath" exception as provided
jtulach@1334
     9
 * by Oracle in the LICENSE file that accompanied this code.
jtulach@1334
    10
 *
jtulach@1334
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
jtulach@1334
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jtulach@1334
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
jtulach@1334
    14
 * version 2 for more details (a copy is included in the LICENSE file that
jtulach@1334
    15
 * accompanied this code).
jtulach@1334
    16
 *
jtulach@1334
    17
 * You should have received a copy of the GNU General Public License version
jtulach@1334
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
jtulach@1334
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jtulach@1334
    20
 *
jtulach@1334
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jtulach@1334
    22
 * or visit www.oracle.com if you need additional information or have any
jtulach@1334
    23
 * questions.
jtulach@1334
    24
 */
jtulach@1334
    25
jtulach@1334
    26
package java.security;
jtulach@1334
    27
jtulach@1334
    28
jtulach@1334
    29
/**
jtulach@1334
    30
 * A computation to be performed with privileges enabled, that throws one or
jtulach@1334
    31
 * more checked exceptions.  The computation is performed by invoking
jtulach@1334
    32
 * <code>AccessController.doPrivileged</code> on the
jtulach@1334
    33
 * <code>PrivilegedExceptionAction</code> object.  This interface is
jtulach@1334
    34
 * used only for computations that throw checked exceptions;
jtulach@1334
    35
 * computations that do not throw
jtulach@1334
    36
 * checked exceptions should use <code>PrivilegedAction</code> instead.
jtulach@1334
    37
 *
jtulach@1334
    38
 * @see AccessController
jtulach@1334
    39
 * @see AccessController#doPrivileged(PrivilegedExceptionAction)
jtulach@1334
    40
 * @see AccessController#doPrivileged(PrivilegedExceptionAction,
jtulach@1334
    41
 *                                              AccessControlContext)
jtulach@1334
    42
 * @see PrivilegedAction
jtulach@1334
    43
 */
jtulach@1334
    44
jtulach@1334
    45
public interface PrivilegedExceptionAction<T> {
jtulach@1334
    46
    /**
jtulach@1334
    47
     * Performs the computation.  This method will be called by
jtulach@1334
    48
     * <code>AccessController.doPrivileged</code> after enabling privileges.
jtulach@1334
    49
     *
jtulach@1334
    50
     * @return a class-dependent value that may represent the results of the
jtulach@1334
    51
     *         computation.  Each class that implements
jtulach@1334
    52
     *         <code>PrivilegedExceptionAction</code> should document what
jtulach@1334
    53
     *         (if anything) this value represents.
jtulach@1334
    54
     * @throws Exception an exceptional condition has occurred.  Each class
jtulach@1334
    55
     *         that implements <code>PrivilegedExceptionAction</code> should
jtulach@1334
    56
     *         document the exceptions that its run method can throw.
jtulach@1334
    57
     * @see AccessController#doPrivileged(PrivilegedExceptionAction)
jtulach@1334
    58
     * @see AccessController#doPrivileged(PrivilegedExceptionAction,AccessControlContext)
jtulach@1334
    59
     */
jtulach@1334
    60
jtulach@1334
    61
    T run() throws Exception;
jtulach@1334
    62
}