public class AsyncUploadCache
extends java.lang.Object
asyncUploadMap
which is Map
of file path vs lastModified of upload. The second toBeDeleted
is
Set
of upload which is marked for delete, while it is already
in progress. Before starting an asynchronous upload, it requires to invoke
add(String)
to add entry to asyncUploadMap
. After
asynchronous upload completes, it requires to invoke
remove(String)
to remove entry from
asyncUploadMap
Any modification to this class are immediately
persisted to local file system. asyncUploadMap
is persisted to /
homeDir
/ PENDIND_UPLOAD_FILE
. toBeDeleted
is
persisted to / homeDir
/ TO_BE_DELETED_UPLOAD_FILE
. The /
homeDir
refer to ${rep.home}.Constructor and Description |
---|
AsyncUploadCache() |
Modifier and Type | Method and Description |
---|---|
AsyncUploadCacheResult |
add(java.lang.String fileName)
This methods checks if file can be added to
asyncUploadMap . |
void |
delete(java.lang.String fileName)
This methods deletes asynchronous upload for @param fileName if there
exists asynchronous upload for @param fileName.
|
java.util.Set<java.lang.String> |
deleteOlderThan(long min)
Delete in progress asynchronous uploads which are older than @param min.
|
java.util.Set<java.lang.String> |
getAll()
This methods returns the in progress asynchronous uploads which are not
marked for delete.
|
long |
getLastModified(java.lang.String fileName)
Returns lastModified from
asyncUploadMap if found else returns
0. |
boolean |
hasEntry(java.lang.String fileName,
boolean touch)
This methos checks if asynchronous upload is in progress for @param
fileName.
|
void |
init(java.lang.String homeDir,
java.lang.String path,
int asyncUploadLimit) |
AsyncUploadCacheResult |
remove(java.lang.String fileName)
This methods removes file (if found) from
asyncUploadMap . |
void |
reset()
|
public AsyncUploadCacheResult add(java.lang.String fileName) throws java.io.IOException
asyncUploadMap
. If
yes it adds to asyncUploadMap
and
serializeAsyncUploadMap()
the asyncUploadMap
to disk.AsyncUploadCacheResult
if successfully added to
asynchronous uploads it sets
AsyncUploadCacheResult.setAsyncUpload(boolean)
to true
else sets to false.java.io.IOException
public AsyncUploadCacheResult remove(java.lang.String fileName) throws java.io.IOException
asyncUploadMap
. If
file is found, it immediately serializes the asyncUploadMap
to
disk. This method sets
AsyncUploadCacheResult.setRequiresDelete(boolean)
to true, if
asynchronous upload found to be in toBeDeleted
set i.e. marked
for delete.java.io.IOException
public java.util.Set<java.lang.String> getAll()
public boolean hasEntry(java.lang.String fileName, boolean touch) throws java.io.IOException
java.io.IOException
public long getLastModified(java.lang.String fileName)
asyncUploadMap
if found else returns
0.public void delete(java.lang.String fileName) throws java.io.IOException
java.io.IOException
public java.util.Set<java.lang.String> deleteOlderThan(long min) throws java.io.IOException
asyncUploadMap
java.io.IOException
public void init(java.lang.String homeDir, java.lang.String path, int asyncUploadLimit) throws java.io.IOException, java.lang.ClassNotFoundException
homeDir
- home directory of repository.path
- path of the LocalCache
asyncUploadLimit
- the maximum number of asynchronous uploadsjava.io.IOException
java.lang.ClassNotFoundException
public void reset() throws java.io.IOException
java.io.IOException
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"