KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > security > PrivilegedExceptionAction


1 /*
2  * @(#)PrivilegedExceptionAction.java 1.10 04/05/05
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.security;
9
10
11 /**
12  * A computation to be performed with privileges enabled, that throws one or
13  * more checked exceptions. The computation is performed by invoking
14  * <code>AccessController.doPrivileged</code> on the
15  * <code>PrivilegedExceptionAction</code> object. This interface is
16  * used only for computations that throw checked exceptions;
17  * computations that do not throw
18  * checked exceptions should use <code>PrivilegedAction</code> instead.
19  *
20  * @see AccessController
21  * @see AccessController#doPrivileged(PrivilegedExceptionAction)
22  * @see AccessController#doPrivileged(PrivilegedExceptionAction,
23  * AccessControlContext)
24  * @see PrivilegedAction
25  */

26
27 public interface PrivilegedExceptionAction<T> {
28     /**
29      * Performs the computation. This method will be called by
30      * <code>AccessController.doPrivileged</code> after enabling privileges.
31      *
32      * @return a class-dependent value that may represent the results of the
33      * computation. Each class that implements
34      * <code>PrivilegedExceptionAction</code> should document what
35      * (if anything) this value represents.
36      * @throws Exception an exceptional condition has occurred. Each class
37      * that implements <code>PrivilegedExceptionAction</code> should
38      * document the exceptions that its run method can throw.
39      * @see AccessController#doPrivileged(PrivilegedExceptionAction)
40      * @see AccessController#doPrivileged(PrivilegedExceptionAction,AccessControlContext)
41      */

42
43     T run() throws Exception JavaDoc;
44 }
45
Popular Tags