FileSystem Listeners / Events
Hi to all (but for this, mainly FileSystem and JNode Core Developers),
in these days I'm starting to use a library called libevent, provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached.
Wouldn't be useful to have also in JNode (but in native mode) these features ?
Imagine that JNode itself could notify to any registered FileSystemListener (applications, or better, classes inside applications) any time a FileSystemEvent is generated on the desired objects (files, directories, links, etc.). This grants also High Performance, and reduce the need for Monitor Threads on files changes (as the time between thread sleep is short this is a CPU etc waste).
With this, Applications that will be compatible could manage the event, while others could simply receive a SIGNAL by the OS, for ex. a RESTART of the Application.
Required: Shell Command (add/remove/modify/test listeners), and Core support so all filesystems could use this.
Could be useful for Server Applications, but also with Clients.
Another usage example:
Graphics Application, with a Plug-in structure, where any plug-in is a jar file inside the plug-ins dir of the Application. Without Restarting the Application JNode could notify, or could simply restart the application (not so good approach).
What do you think ?
Bye,
Sandro
- Login to post comments
hmm.... nice, it should be co
hmm.... nice, it should be combined with quartz (http://www.opensymphony.com/quartz/) to make a crontab for the system, that could interact directly with the listeners.
Regards,
Martin
With the proper data structur
With the proper data structures to store the listeners and the proper mechanism to "dispatch" the event to the listeners it would be very fast and usefull.
I have proposed something equal for the networking. For network events (packet received etc). I think listeners/events for FileSystem is much more usefull.