There are a few other things i wanted to share. I actually use the java.util.concurrent.ThreadPoolExecutor to copy files. For those using Java 1.4, here is your gateway to concurrency : http://backport-jsr166.sourceforge.net/
Here goes my ThreadPool code. You surely could write better code than this.
LinkedBlockingQueue archiverTaskQueue = new LinkedBlockingQueue();
ThreadPoolExecutor archiverExecutor = new ThreadPoolExecutor(50, MAXTHREADS, 50000L, TimeUnit.MILLISECONDS,archiverTaskQueue);
File tempCurrentFile=new File(tempDestinationDir, archiveFileName);
archiver = new Archiver(tempCurrentFile, new File(actualDestinationDir, fileName));
archiverExecutor.execute(archiver);
Forgot to mention, I use NIO to copy files. I understand that there are people for and against NIO. My reason for using NIO is just it sounded exciting.
Source code : Archiver.java
Tags: concurrency, copy, copy files, file, java, java.util.concurrent, mulithread, NIO, source code, threadpoolexecutor