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