Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
I think I understood your questions. There were more than one, some implicit. Here are my answers: