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