This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Several failed attempts have made me very unsure of myself and I need your advise and expertise. I'll be as brief as possible.
I have banks of servers set up in 4 different configurations. I must be able to select one or more of these servers and ask them for the file count of specific directories every 2-3 seconds. (Could be a few seconds longer if needed) The server names and information for each is read in from a text file. The list of directories to monitor is also in the text file. This monitoring must go on non-stop changing if a different sever is selected. The servers are linux. I have used ProcessBuilder to build commands to retrieve the file counts and updated the counts with the return. While this is a heave way to go is works and I may go back to it. I have tried to open sockets to selected servers and request file_count from each server and have it return counts but the sockets have proven a nightmare. When they work it is great but they stop for no reason I can determine and have been very hard to work with for my complicated tasks. File counts are not the only thing I need to interact with the servers. I send many different requests to the servers like copy files (thousands of files), move files, edit files, generate reports and statistics. It all seems to break down with the constant file counting. If anyone has any good advise I would love to hear it.
Vernon Mimms wrote:It all seems to break down with the constant file counting. If anyone has any good advise I would love to hear it.
1. This sounds like an admin function to me. Have you asked one of your friendly sysadmins if they have anything that might help (and that they're prepared to let you use )?
2. Whatever you're doing, all this counting sounds incredibly "busy" to me. Have you looked at alternatives, like notifiers; or is this something you've simply been "told to do"?
3. Have you looked at the WatchService API?
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here