public final class CopyEngine
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private class |
CopyEngine.CopyThread |
Modifier and Type | Field and Description |
---|---|
private static int |
BUFFER_SIZE
The default buffer size
|
private boolean |
done
Should we terminate ?
|
private java.util.Map<java.lang.String,CopyInfo> |
finished
Finished copies
|
private static org.slf4j.Logger |
LOGGER
A logger for this class
|
private static java.lang.String |
NAME
The name of this unit
|
private long |
nextID
Current Copy ID
|
private Files |
owner
A Files used to access the files that need to be copied.
|
private java.util.Deque<CopyInfo> |
pending
Pending copies
|
private static int |
POLLING_DELAY
The polling delay
|
private CopyInfo |
running
Running copy
|
Constructor and Description |
---|
CopyEngine(Files owner) |
Modifier and Type | Method and Description |
---|---|
private void |
append(Path source,
long fromOffset,
Path target,
CopyInfo ac) |
CopyStatus |
cancel(Copy copy) |
private void |
close(java.io.Closeable c) |
private boolean |
compareHead(CopyInfo ac,
Path target,
Path source) |
void |
copy(CopyInfo info) |
private CopyInfo |
dequeue() |
private void |
doAppend(CopyInfo ac) |
private void |
doCopy(CopyInfo ac) |
void |
done() |
private void |
doResume(CopyInfo ac) |
private void |
enqueue(CopyInfo info) |
java.lang.String |
getNextID(java.lang.String prefix) |
CopyStatus |
getStatus(Copy copy) |
private int |
readFully(java.io.InputStream in,
byte[] buffer) |
private void |
startCopy(CopyInfo info) |
private void |
streamCopy(java.io.InputStream in,
java.io.OutputStream out,
CopyInfo ac) |
private void |
waitUntilCancelled(java.lang.String copyID) |
private static final org.slf4j.Logger LOGGER
private static final java.lang.String NAME
private static final int POLLING_DELAY
private static final int BUFFER_SIZE
private final Files owner
private final java.util.Deque<CopyInfo> pending
private final java.util.Map<java.lang.String,CopyInfo> finished
private CopyInfo running
private long nextID
private boolean done
public CopyEngine(Files owner)
private void close(java.io.Closeable c)
private void streamCopy(java.io.InputStream in, java.io.OutputStream out, CopyInfo ac) throws java.io.IOException
java.io.IOException
private void append(Path source, long fromOffset, Path target, CopyInfo ac) throws XenonException
XenonException
private int readFully(java.io.InputStream in, byte[] buffer) throws java.io.IOException
java.io.IOException
private boolean compareHead(CopyInfo ac, Path target, Path source) throws XenonException, java.io.IOException
XenonException
java.io.IOException
private void doResume(CopyInfo ac) throws XenonException
XenonException
private void doAppend(CopyInfo ac) throws XenonException
XenonException
private void doCopy(CopyInfo ac) throws XenonException
XenonException
private void startCopy(CopyInfo info)
public void copy(CopyInfo info)
public void done()
private void enqueue(CopyInfo info)
private CopyInfo dequeue()
private void waitUntilCancelled(java.lang.String copyID)
public CopyStatus cancel(Copy copy) throws NoSuchCopyException
NoSuchCopyException
public CopyStatus getStatus(Copy copy) throws NoSuchCopyException
NoSuchCopyException
public java.lang.String getNextID(java.lang.String prefix)