开发者

Design pattern for file based communication?

开发者 https://www.devze.com 2022-12-18 15:43 出处:网络
I have to extend an existing program (Java-based, but this shouldn\'t count). This program should communicate with another program X.

I have to extend an existing program (Java-based, but this shouldn't count). This program should communicate with another program X.

This program X is .. uhm.. a little bit older and supports only file based communication. This means I have to put my file into some specific folder. The "answer" is plac开发者_如何学编程ed in another folder where I have to pick it up.

Are there any design patterns for this kind of communication? Problems with file-locking, unflushed io-streams etc. come to my mind if I think about it.

Do you have some more descriptive keywords for my googleing? "file based communication" doesn't take it.


Maybe Producer-Consumer pattern is what you want.

I belive you'll find better articles then the article in wikipedia. But main concepts are described there clear enough (just replace 'buffer' with 'file' for your concrete case).


I don't know if it is possible to create file system watchers in java (like it is in C#), but I do always use a file system watcher to monitor the folder which receives files.

0

精彩评论

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

关注公众号