What Directory Monitor For

Directory Monitor is a windows service which tracks folder changes, such as; file creation, removal, modification or rename. It is able to handle multiple locations at once. There is the ability to watch network shares in addition to local folders. Directory monitor does not execute anything, we have a separate windows service for it, called execution agent. When change happens, directory monitor inserts a record into queue table. There is no need to restart Directory monitor service when user amends the settings.
 

How Directory Monitor Works

Database

Holds the overall status of directory monitor: is it enabled or not and settings for individual threads events to monitor for: filter, waits

Users

Create, amend and delete monitors settings.

Management thread

Responsible for creating, updating and destroying monitor threads.

Monitor thread

Monitors single directory for changes.
When an event happens, it inserts a record into queue table.

File usage thread

Creates and runs file usage tasks
When create event happen it might take some time to release the file.
(It might take 5 minutes to copy a file)

File usage task

The task is just a procedure which checks if the file is open. For example, one task checks filea.txt, another check filleb.txt and so on. Threads are very heavy and there is OS limitation how many threads we can create. Creating thousands of threads is definitely a stupid idea. The task is very light and while one task is waiting for x milliseconds another one is being executed. The way it works, it checks if the file is open if it is, it sleeps for some time and checks it again. Once the file is closed or a timeout happens it inserts a record into queue table. Checking is done by opening a file for writing.

Download Free Trial

We have 326 guests and no members online