1. /*
  2. * @(#)PrivilegedAction.java 1.6 00/02/02
  3. *
  4. * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.security;
  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. public interface PrivilegedAction {
  24. /**
  25. * Performs the computation. This method will be called by
  26. * <code>AccessController.doPrivileged</code> after enabling privileges.
  27. *
  28. * @return a class-dependent value that may represent the results of the
  29. * computation. Each class that implements
  30. * <code>PrivilegedAction</code>
  31. * should document what (if anything) this value represents.
  32. * @see AccessController#doPrivileged(PrivilegedAction)
  33. * @see AccessController#doPrivileged(PrivilegedAction,
  34. * AccessControlContext)
  35. */
  36. Object run();
  37. }