Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Mar 03, 2014 Mar 03, 2014

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?

628
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 04, 2014 Mar 04, 2014

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 04, 2014 Mar 04, 2014

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 04, 2014 Mar 04, 2014
LATEST

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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources