3 Replies Latest reply on Mar 4, 2014 10:39 AM by BKBK

    is the directory watcher multi-threaded once it calls the cfc?

    casey w

      the docs say there's a single thread that watches the directory.  But say for example it finds 3 files and calls the cfc.  At that point do all 3 files run one at a time on a single thread in the order they came in, or do they run at the same time on multi-threads?

        • 1. Re: is the directory watcher multi-threaded once it calls the cfc?
          BKBK Adobe Community Professional & MVP

          Yes, the directory-watcher runs in a single thread. However, the question whether or not "all 3 files run one at a time" is irrelevant. It is the directory-watcher that runs.

           

          When the watcher runs, ColdFusion records the current state of the directory. The watcher then sleeps for the duration of the interval. The interval is, by default, 60 seconds. When the watcher re-awakes, it compares the present state of the directory with the saved state. It then knows - at once, during the same single thread - which files have been added, deleted or changed.

          • 2. Re: is the directory watcher multi-threaded once it calls the cfc?
            casey w Level 1

            Maybe i didn't word the question correctly, but i'm not asking if the directory watcher itself is multi-threaded, which is what you describe.  I'm asking when it calls the cfc, are the calls to the cfc multi-threaded?  So again my example, if there are 3 files that the directory watcher finds, then the cfc has to be called 3 times correct?  So are those 3 calls to the cfc multi-threaded and can run simultaneously, or do those 3 calls to the cfc have to run one at a time in the order the files came in?

            • 3. Re: is the directory watcher multi-threaded once it calls the cfc?
              BKBK Adobe Community Professional & MVP

              I think I understood your questions. There were more than one, some implicit. Here are my answers:

               

              • ColdFusion runs the directory-watcher in a single thread.
              • During the execution of the same thread, ColdFusion detects whether of not a file has, or any number of files have, been added, deleted or changed.
              • When ColdFusion calls the CFC, it does so in that same single thread. My guess is that any file add-events, delete-events and change-events are queued and handled one after the other.