1. /*
  2. * @(#)ActiveEvent.java 1.13 03/12/19
  3. *
  4. * Copyright 2004 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 to 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.13 12/19/03
  31. * @since 1.2
  32. */
  33. public interface ActiveEvent {
  34. /**
  35. * Dispatch the event to its target, listeners of the events source,
  36. * or do whatever it is this event is supposed to do.
  37. */
  38. public void dispatch();
  39. }