开发者

Concurrency accessing a shared resource

开发者 https://www.devze.com 2023-04-08 18:19 出处:网络
I am writing a Java application, that access to a configuration file stored as a shared resource in a Windows server. The app is thought to be used by around 500 employees, so it made me think about c

I am writing a Java application, that access to a configuration file stored as a shared resource in a Windows server. The app is thought to be used by around 500 employees, so it made me think about concurrency.

Related to the implementation, I access to the file through JCIFS library, then I used an inputStream to read and treat it. I guess VM have nothing to do with this nor application code, so I point out to the OS, in this case windows.

I don't know where or how must be treated this issue or even if I have to.

In other hand, we are talking about a remote file, but what happens if the file is located in our filesystem? In this case, VM has something to say hasn't it? How many different input streams can be opened over a file? and output streams?

I know that these are not concrete questions, so it must be difficult to answer them. But any help, comment o开发者_JS百科r advices would be very appreciated.

Thanks in advance!!


In other hand, we are talking about a remote file, but what happens if the file is located in our filesystem?

Its still an InputStream.

In this case, VM has something to say hasn't it?

It can if you want to, but generally not.

How many different input streams can be opened over a file?

Limited by the OS, usually thousands.

and output streams?

The same. But if you write to a file with more than one process the results could be a mess, but you are more likely to get the output from just one program. (But you wouldn't know which without re-reading it)


Is the file going to be written to while your application is consuming it? If its not then I can't imagine it being a problem. Think about multiple editors with the same file open at the same time - no harm no foul till someone makes a change and writes it.

0

精彩评论

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

关注公众号