I was instructed to create a special file backup service that will allow any laptops using this service to back up certain directories when connected to our network server. The requirement that was provided to me is that the service should mainly give priority to the normal operation of the user on this laptop and not interfere with performance ... too much. I created this Java program to port it as a service using YAJSW. I know that I can set the "Process Priority" to LOW, which allows:
Process threads are superseded by threads of any process operating at a higher priority level.
Because of this, I thought I would use a stream to transfer files with the idea that these streams would do just that. I currently have something like this:
public void copyFiles() {
for (ScannedFile file : filesToCopy) {
new Thread() {
@Override
public void run() {
fileCopyUsingStreams(file);
}
}.start();
}
}
However, I'm not sure if this will work the way I think. I also thought, as an alternative to this, that I could run these threads sequentially in the hope of increasing the likelihood of "priority damage." I am looking for any ideas and improvements that you all could provide. Thank.
source
share