• header.categories
    • header.recent
    • header.tags
    • header.popular
    • register
    • login

    Synchronization between rules and timer handlers

    scheduled pinned locked moved General Discussion
    6 posts 2 posters 2.3k views 1 watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • B offline
      benya
      global:last-edited-by, benya

      How does MyController handle rules and timers?
      Do they execute operations from concurrent threads?
      Should we worry about synchronization when scripts read/write repository variables?

      Or all scripts are executed by a single thread and there are no concurrency issues?

      jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
      • jkandasaJ offline
        jkandasa @benya
        global:last-edited-by,

        @benya Rules and timers are running on different threads. When you fetch repository variable, it becomes your local reference, If you do change it will override existing value.

        B one-reply-to-this-post last-reply-time reply quote 0
        • B offline
          benya @jkandasa
          global:last-edited-by,

          @jkandasa We need some mechanism to prevent race condition.

          one-reply-to-this-post last-reply-time reply quote 1
          • B offline
            benya
            global:last-edited-by,

            Is any <String, Object> map accessible to Groovy scripts?
            It would be possible to store there generic objects and use them for synchronization.

            jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
            • jkandasaJ offline
              jkandasa @benya
              global:last-edited-by,

              @benya Do you face any issue with out Synchronization?

              B one-reply-to-this-post last-reply-time reply quote 0
              • B offline
                benya @jkandasa
                global:last-edited-by,

                @jkandasa said:

                @benya Do you face any issue with out Synchronization?

                I face potential issue in the following scenario:

                • multiple PIRs tigger rule that reads/writes global variable and disables/enables timer
                • timer reads global variable as well
                • timer has counter=1 and self-disables when triggered

                Therefore I need to synchronize access to the global variable and modifications of timer object.
                Otherwise global variable and timer could be left in an unexpected state.

                one-reply-to-this-post last-reply-time reply quote 0
                • first-post
                  last-post

                0

                online

                644

                users

                532

                topics

                3.4k

                posts
                Copyright © 2015-2025 MyController.org | Contributors | Localization