Operating system event handlers using java

I have a java process as a daemon that monitors directroy on the file system. Once a newy file is added to the java process, it will process the directory of the file by executing some logic. At present, in my implementation, the daemon checks the folder every 10 seconds. If a new file is added, it will start processing it

Is there a way that the folder will notify the process to add new files, and then the process can start working. The event handler on its own folder is the operating system level of Java API. Can I do this? In Java?

Solution

I don't know. In any case, you may have to change (create your own) file system drivers for folders that notify you of something

System events are very dependent on the operating system, and Java is designed just the opposite

It depends on how fast you want the daemon to respond Sleep method can shorten sleep time, but it will occupy more CPU cycles

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>