forked from Qortal/qortal
Moved deletion retry code into ArbitraryDataFile
This commit is contained in:
parent
3e505481fe
commit
464ce66fd5
@ -366,6 +366,21 @@ public class ArbitraryDataFile {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean delete(int attempts) {
|
||||||
|
// Keep trying to delete the data until it is deleted, or we reach 10 attempts
|
||||||
|
for (int i=0; i<attempts; i++) {
|
||||||
|
if (this.delete()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000L);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// Fall through to exit method
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean deleteAllChunks() {
|
public boolean deleteAllChunks() {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
|
||||||
|
@ -240,16 +240,7 @@ public class ArbitraryDataFileManager extends Thread {
|
|||||||
ArbitraryDataFile dataFile = arbitraryDataFileMessage.getArbitraryDataFile();
|
ArbitraryDataFile dataFile = arbitraryDataFileMessage.getArbitraryDataFile();
|
||||||
|
|
||||||
// Keep trying to delete the data until it is deleted, or we reach 10 attempts
|
// Keep trying to delete the data until it is deleted, or we reach 10 attempts
|
||||||
for (int i=0; i<10; i++) {
|
dataFile.delete(10);
|
||||||
if (dataFile.delete()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000L);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
// Fall through to exit method
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user