1. /*
  2. * @(#)ActiveEvent.java 1.7 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt;
  8. /**
  9. * An interface for events that know how dispatch themselves.
  10. * By implementing this interface an event can be placed upon the event
  11. * queue and its <code>dispatch()</code> method will be called when the event
  12. * is dispatched, using the <code>EventDispatchThread</code>.
  13. * <p>
  14. * This is a very useful mechanism for avoiding deadlocks. If
  15. * a thread is executing in a critical section (i.e., it has entered
  16. * one or more monitors), calling other synchronized code may
  17. * cause deadlocks. To avoid the potential deadlocks, an
  18. * <code>ActiveEvent</code> can be created to run the second section of
  19. * code at later time. If there is contention on the monitor,
  20. * the second thread will simply block until the first thread
  21. * has finished its work and exited its monitors.
  22. * <p>
  23. * For security reasons, it is often desirable to use an <code>ActiveEvent</code>
  24. * to avoid calling untrusted code from a critical thread. For
  25. * instance, peer implementations can use this facility to avoid
  26. * making calls into user code from a system thread. Doing so avoids
  27. * potential deadlocks and denial-of-service attacks.
  28. *
  29. * @author Timothy Prinzing
  30. * @version 1.7 11/29/01
  31. */
  32. public interface ActiveEvent {
  33. /**
  34. * Dispatch the event to it's target, listeners of the events source,
  35. * or do whatever it is this event is supposed to do.
  36. */
  37. public void dispatch();
  38. }