Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-19

Provide built-ins to enforce join dependencies between threads

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 1.0.3
    • 1.0.2
    • None
    • None

    Description

      Sometimes application threads do not always employ explicit join calls in order to ensure related threads shut down. For example, a socket listener may not explictly the threads it creates to handle incoming connections. Instead it may just notify the thread via a shared object, relying on the fact that the thread will detect the notification and exit. This may be adequate for the application to run but it may not be enough for a test to proceed correctly. The following built-ins will allow byteman rules to inject explicit joins where required:

      boolean createJoin(Object key, int expected)
      boolean isJoin(Object key, int expected)
      boolean joinEnlist(Object key, int expected)
      boolean joinWait(Object key, int expected)

      In all cases key is used to idenitfy a Joiner instance used to coordinate the join operation(s). expected is the number of threads which are to be joined.

      createJoin creates a Joiner.

      isJoin tests if such a Joiner exists.

      joinEnlist must be called from a thread which needs to be joined. It enlists the calling thread in a list associated with the Joiner. If returns true if the thread is added to the list, allowing the thread to proceed and, eventually, exit. It returns false if a joiner is not found with the expected count or the number of threads in the list has already reached the expected count.

      joinWait suspends, where necessary, until the Joiner list contains the expected number of threads. It then proceeds to call join on each thread in the list, returning true only after all the threads have exited. It returns false if a joiner is not found with the expected count.

      Attachments

        Activity

          People

            rhn-engineering-adinn Andrew Dinn
            rhn-engineering-adinn Andrew Dinn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: