|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
it.geosolutions.tools.io.file.FileRemover
public final class FileRemover
Simple class implementing a Thread that periodically tries to delete the files that were provided to him.
It tries to delete each file at most maxAttempts
number
of times. If this number is exceeded it simply throws the file away notifying
the users with a warning message.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
FileRemover()
Deprecated. Default constructor for a FileRemover . |
|
FileRemover(long period,
int priority,
int maxattempts)
Deprecated. Constructor for a FileRemover . |
Method Summary | |
---|---|
void |
addFile(File fileToDelete)
Deprecated. Asks this FileRemover to clean up this file. |
static List<File> |
collectOlder(long time,
int daysAgo,
File root)
Deprecated. |
int |
getMaxAttempts()
Deprecated. Retrieves the maximum number of times we try to delete a file before giving up. |
long |
getPeriod()
Deprecated. Retrieves the period in seconds for this FileRemover . |
void |
run()
Deprecated. This method does the magic: iterate over all the files try to delete it if successful drop the file references if not successful increase the attempts count for the file and call the gc. |
void |
setMaxAttempts(int maxAttempts)
Deprecated. Sets the maximum number of times we try to delete a file before giving up. |
void |
setPeriod(long period)
Deprecated. Sets the period in seconds for this FileRemover . |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileRemover()
FileRemover
.
public FileRemover(long period, int priority, int maxattempts)
FileRemover
.
period
- default time period between two cycles.priority
- is the priority for the cleaner thread.maxattempts
- maximum number of time the cleaner thread tries to delete a
file.Method Detail |
---|
public static List<File> collectOlder(long time, int daysAgo, File root)
public void addFile(File fileToDelete)
FileRemover
to clean up this file.
fileToDelete
- File
that we want to permanently delete.public void run()
run
in interface Runnable
run
in class Thread
public int getMaxAttempts()
public void setMaxAttempts(int maxAttempts)
maxAttempts
- the maximum number of times we try to delete a file before
giving up.public long getPeriod()
FileRemover
.
FileRemover
.public void setPeriod(long period)
FileRemover
.
period
- the new period for this FileRemover
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |