开发者

Offsetting one of the disadvantages of an XML file

I'm using an XML file to store a set of rules that my program, a service will read and apply. Obviously, as and when I add new rules to the XML file, i will have to bounce the service so that the changes can be effective.

Is there a way I can keep 'polling' the XML file every 30s or so to avoid having to bounce my service, in the event that my XML rules fi开发者_运维技巧le changes?

Thanks


I don't know which language and platform you are using, but very often there is an OS facility to watch for file system changes. This is much more efficient than polling. .NET has a FileSystemWatcher class that lets you access this mechanism to monitor a file for changes. The Mono .NET framework also supports FileSystemWatcher although it has some specific technical requirements (see http://www.mono-project.com/FAQ:_Technical).

Try to stay away from polling on this if you can.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜