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

Define and reuse a different interface for use in the invokeLater(Runnable obj).

XMLWordPrintable

    • generic
    • solaris_2.5

      The use of java.lang.Runnable in SwingUtilities.invokeLater(Runnable obj) is
      misleading. It lead me to infer that the run() method of the Runnable is called
      in a new thread launched by the AWT-dispatcher thread. If the intention was to have an interface with a well known method with no parameters - might as well
      define a new interface

      public interface com.sun.java.swing.LaterInvokable()
      {
      public void nowDoit();
      }

      Somehow the Runnable interface is strongly associated with the java threading
      in my and other java programmer's mind's.

      Here is what the javadoc for Runnable says -

      The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread. The class must
      define a method of no arguments called run.

      This interface is designed to provide a common protocol for objects that wish to execute code while they are active. For example,
      Runnable is implemented by class Thread. Being active simply means that a thread has been started and has not yet been stopped.

      sandip.chitale@Eng 1998-06-11

            svioletsunw Scott Violet (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: