KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > security > PrivilegedAction


1 /*
2  * @(#)PrivilegedAction.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. The computation is
13  * performed by invoking <code>AccessController.doPrivileged</code> on the
14  * <code>PrivilegedAction</code> object. This interface is used only for
15  * computations that do not throw checked exceptions; computations that
16  * throw checked exceptions must use <code>PrivilegedExceptionAction</code>
17  * instead.
18  *
19  * @see AccessController
20  * @see AccessController#doPrivileged(PrivilegedAction)
21  * @see PrivilegedExceptionAction
22  */

23
24 public interface PrivilegedAction<T> {
25     /**
26      * Performs the computation. This method will be called by
27      * <code>AccessController.doPrivileged</code> after enabling privileges.
28      *
29      * @return a class-dependent value that may represent the results of the
30      * computation. Each class that implements
31      * <code>PrivilegedAction</code>
32      * should document what (if anything) this value represents.
33      * @see AccessController#doPrivileged(PrivilegedAction)
34      * @see AccessController#doPrivileged(PrivilegedAction,
35      * AccessControlContext)
36      */

37     T run();
38 }
39
Popular Tags