fix #577 delete temp directory
This commit is contained in:
parent
06115f6de9
commit
cd1a1bc936
2 changed files with 6 additions and 40 deletions
|
@ -28,6 +28,7 @@ import java.util.Properties;
|
|||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
|
@ -68,10 +69,6 @@ public class CrawlJob {
|
|||
|
||||
protected int documentExpires = -2;
|
||||
|
||||
protected int retryCountToDeleteTempDir = 10;
|
||||
|
||||
protected long retryIntervalToDeleteTempDir = 5000;
|
||||
|
||||
protected boolean useLocalElasticsearch = true;
|
||||
|
||||
protected String jvmOptions;
|
||||
|
@ -128,12 +125,6 @@ public class CrawlJob {
|
|||
return this;
|
||||
}
|
||||
|
||||
public CrawlJob retryToDeleteTempDir(final int retryCount, final long retryInterval) {
|
||||
retryCountToDeleteTempDir = retryCount;
|
||||
retryIntervalToDeleteTempDir = retryInterval;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CrawlJob useLocaleElasticsearch(final boolean useLocaleElasticsearch) {
|
||||
this.useLocalElasticsearch = useLocaleElasticsearch;
|
||||
return this;
|
||||
|
@ -443,17 +434,9 @@ public class CrawlJob {
|
|||
if (ownTmpDir == null) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < retryCountToDeleteTempDir; i++) {
|
||||
if (ownTmpDir.delete()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(retryIntervalToDeleteTempDir);
|
||||
} catch (final InterruptedException e) {
|
||||
// ignore
|
||||
}
|
||||
if (!FileUtils.deleteQuietly(ownTmpDir)) {
|
||||
logger.warn("Could not delete a temp dir: " + ownTmpDir.getAbsolutePath());
|
||||
}
|
||||
logger.warn("Could not delete a temp dir: " + ownTmpDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void appendJarFile(final String cpSeparator, final StringBuilder buf, final File libDir, final String basePath) {
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Properties;
|
|||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
import org.codelibs.fess.Constants;
|
||||
|
@ -54,10 +55,6 @@ public class SuggestJob {
|
|||
|
||||
protected String logLevel;
|
||||
|
||||
protected int retryCountToDeleteTempDir = 10;
|
||||
|
||||
protected long retryIntervalToDeleteTempDir = 5000;
|
||||
|
||||
public SuggestJob jobExecutor(final JobExecutor jobExecutor) {
|
||||
this.jobExecutor = jobExecutor;
|
||||
return this;
|
||||
|
@ -78,12 +75,6 @@ public class SuggestJob {
|
|||
return this;
|
||||
}
|
||||
|
||||
public SuggestJob retryToDeleteTempDir(final int retryCount, final long retryInterval) {
|
||||
retryCountToDeleteTempDir = retryCount;
|
||||
retryIntervalToDeleteTempDir = retryInterval;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SuggestJob useLocaleElasticsearch(final boolean useLocaleElasticsearch) {
|
||||
this.useLocaleElasticsearch = useLocaleElasticsearch;
|
||||
return this;
|
||||
|
@ -288,17 +279,9 @@ public class SuggestJob {
|
|||
if (ownTmpDir == null) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < retryCountToDeleteTempDir; i++) {
|
||||
if (ownTmpDir.delete()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(retryIntervalToDeleteTempDir);
|
||||
} catch (final InterruptedException e) {
|
||||
// ignore
|
||||
}
|
||||
if (!FileUtils.deleteQuietly(ownTmpDir)) {
|
||||
logger.warn("Could not delete a temp dir: " + ownTmpDir.getAbsolutePath());
|
||||
}
|
||||
logger.warn("Could not delete a temp dir: " + ownTmpDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void appendJarFile(final String cpSeparator, final StringBuilder buf, final File libDir, final String basePath) {
|
||||
|
|
Loading…
Add table
Reference in a new issue