public final class TachyonFileSystemUtils extends Object
TachyonFileSystem
related objectsModifier and Type | Method and Description |
---|---|
static boolean |
waitCompleted(tachyon.client.file.TachyonFileSystemCore tfs,
TachyonURI uri)
Shortcut for
waitCompleted(tfs, uri, -1, TimeUnit.MILLISECONDS) , i.e., wait for an
indefinite amount of time. |
static boolean |
waitCompleted(tachyon.client.file.TachyonFileSystemCore tfs,
TachyonURI uri,
long timeout,
TimeUnit tunit)
Wait for a file to be marked as completed.
|
public static boolean waitCompleted(tachyon.client.file.TachyonFileSystemCore tfs, TachyonURI uri) throws IOException, TachyonException, InterruptedException
waitCompleted(tfs, uri, -1, TimeUnit.MILLISECONDS)
, i.e., wait for an
indefinite amount of time. Note that if a file is never completed, the thread will block
forever, so use with care.tfs
- a TachyonFileSystemCore
instanceuri
- the URI of the file on which the thread should waitIOException
- in case there are problems contacting the Tachyonmaster
for the file statusTachyonException
- if a Tachyon Exception occursInterruptedException
- if the thread receives an interrupt while
waiting for file completionwaitCompleted(TachyonFileSystemCore, TachyonURI, long, TimeUnit)
public static boolean waitCompleted(tachyon.client.file.TachyonFileSystemCore tfs, TachyonURI uri, long timeout, TimeUnit tunit) throws IOException, TachyonException, InterruptedException
timeout
time units (as specified via
tunit
or until the TachyonFile is reported as complete by the master. The method will
return the last known completion status of the file (hence, false only if the method has timed
out). A zero value on the timeout
parameter will make the calling thread check once and
return; a negative value will make it block indefinitely. Note that, in this last case, if a
file is never completed, the thread will block forever, so use with care.
Note that the file whose uri is specified, might not exist at the moment this method this call.
The method will deliberately block anyway for the specified amount of time, waiting for the
file to be created and eventually completed. Note also that the file might be moved or deleted
while it is waited upon. In such cases the method will throw the a TachyonException
with the appropriate TachyonExceptionType
IMPLEMENTATION NOTES This method is implemented
by periodically polling the master about the file status. The
polling period is controlled by the Constants.USER_FILE_WAITCOMPLETED_POLL_MS
java property and defaults to a generous 1 second.tfs
- an instance of TachyonFileSystemCore
uri
- the URI of the file whose completion status is to be watied for.timeout
- maximum time the calling thread should be blocked on this call.tunit
- the @{link TimeUnit} instance describing the timeout
parameterIOException
- in case there are problems contacting the Tachyonmaster for the file statusTachyonException
- if a Tachyon Exception occursInterruptedException
- if the thread receives an interrupt while waiting for file
completionCopyright © 2015. All Rights Reserved.