Package org.apache.lucene.replicator.nrt
Class CopyJob
java.lang.Object
org.apache.lucene.replicator.nrt.CopyJob
- All Implemented Interfaces:
Comparable<CopyJob>
Handles copying one set of files, e.g. all files for a new NRT point, or files for pre-copying a
merged segment. This notifies the caller via OnceDone when the job finishes or failed.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Callback invoked by CopyJob once all files have (finally) finished copying -
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected CopyOneFile
protected final ReplicaNode
protected Throwable
protected final Map<String,
FileMetaData> final boolean
True for an NRT sync, false for pre-copying a newly merged segmentfinal CopyJob.OnceDone
final long
final String
final long
protected final List<Map.Entry<String,
FileMetaData>> protected long
protected long
-
Constructor Summary
ModifierConstructorDescriptionprotected
CopyJob
(String reason, Map<String, FileMetaData> files, ReplicaNode dest, boolean highPriority, CopyJob.OnceDone onceDone) -
Method Summary
Modifier and TypeMethodDescriptionvoid
abstract boolean
Return true if this job is trying to copy any of the same files as the other jobabstract void
finish()
Renames all copied (tmp) files to their true file namesabstract CopyState
abstract boolean
Returns all file names referenced in this copy jobReturns only those file names (a subset ofgetFileNames()
) that need to be copiedabstract long
protected abstract CopyOneFile
newCopyOneFile
(CopyOneFile current) abstract void
Use current thread (blocking) to do all copying and then return once done, or throw exception on failureabstract void
start()
Begin copying filesvoid
transferAndCancel
(CopyJob prevJob) Transfers whatever tmp files were already copied in this previous job and cancels the previous jobMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
dest
-
files
-
ord
public final long ord -
highPriority
public final boolean highPriorityTrue for an NRT sync, false for pre-copying a newly merged segment -
onceDone
-
startNS
public final long startNS -
reason
-
toCopy
-
totBytes
protected long totBytes -
totBytesCopied
protected long totBytesCopied -
current
-
exc
-
cancelReason
-
copiedFiles
-
-
Constructor Details
-
CopyJob
protected CopyJob(String reason, Map<String, FileMetaData> files, ReplicaNode dest, boolean highPriority, CopyJob.OnceDone onceDone) throws IOException- Throws:
IOException
-
-
Method Details
-
transferAndCancel
Transfers whatever tmp files were already copied in this previous job and cancels the previous job- Throws:
IOException
-
newCopyOneFile
-
start
Begin copying files- Throws:
IOException
-
runBlocking
Use current thread (blocking) to do all copying and then return once done, or throw exception on failure- Throws:
Exception
-
cancel
- Throws:
IOException
-
conflicts
Return true if this job is trying to copy any of the same files as the other job -
finish
Renames all copied (tmp) files to their true file names- Throws:
IOException
-
getFailed
public abstract boolean getFailed() -
getFileNamesToCopy
Returns only those file names (a subset ofgetFileNames()
) that need to be copied -
getFileNames
Returns all file names referenced in this copy job -
getCopyState
-
getTotalBytesCopied
public abstract long getTotalBytesCopied()
-