public static CopyMonitor create ( TransferManager manager , CopyImpl transfer , ExecutorService threadPool , CopyCallable multipartCopyCallable , CopyObjectRequest copyObjectRequest , ProgressListenerChain progressListenerChain ) { CopyMonitor copyMonitor = new CopyMonitor ( manager , transfer , threadPool , multipartCopyCallable , copyObjectRequest , progressListenerChain ) ; Future < CopyResult > thisFuture = threadPool . submit ( copyMonitor ) ; // Use an atomic compareAndSet to prevent a possible race between the // setting of the CopyMonitor's futureReference, and setting the // CompleteMultipartCopy's futureReference within the call() method. // We only want to set the futureReference to CopyMonitor's futureReference if the // current value is null, otherwise the futureReference that's set is // CompleteMultipartCopy's which is ultimately what we want. copyMonitor . futureReference . compareAndSet ( null , thisFuture ) ; return copyMonitor ; }
Constructs a new watcher for copy operation and then immediately submits it to the thread pool .