Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4617063

spec for EventQueue is totally contradictory

XMLWordPrintable

    • b21
    • sparc
    • solaris_2.6
    • Not verified



      Name: atR10191 Date: 12/21/2001


      specification for the methods
       public static void invokeAndWait(Runnable runnable)
       public static void invokeLater(Runnable runnable) mentions
      "the EventQueue". But these are static methods, so they cannot reference "this".
      One can guess that this mysterious "the EventQueue" is
      Toolkit.getDefaultToolkit().getSystemEventQueue(). But maybe it's
      "the EventQueue associated with the calling thread", which is
      mentioned in the spec for another method (public static AWTEvent getCurrentEvent())?
      Also it is not clear how to obtain such an "associated EventQueue",
      does every thread have associated EventQueue and
      what this association means.

      Another inconsistency: specification for the method
       public static long getMostRecentEventTime() states :

       "Returns the timestamp of the most recent event that had a timestamp,
        and that was dispatched from the EventQueue associated with the calling thread.
         ...
        Note that this method should only be invoked from an application's event dispatching thread.
        ..."
      This method is public, so how can we obtain such an
       "application's event dispatching thread"?

      And again about method
       public static void invokeAndWait(Runnable runnable).
       
      Spec states: "This method will throw an Error if called from the event
      dispatcher thread." Fortunately, there is a method isDispatchThread(),
      which allows us to know if the calling thread is the current AWT
      EventQueue's dispatch thread. But on the other hand it is completely
      unclear, how to create such a "current AWT EventQueue's dispatch
      thread" or obtain reference to it and how to create thread, which is not
      dispatching. Can we guess that when we are creating thread, it is not dispatching?

      ======================================================================

            dav Andrei Dmitriev (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: