Skip to content
Snippets Groups Projects
Commit 18ee2b4b authored by ribeaudc's avatar ribeaudc
Browse files

change: - Put the time out and sleep milliseconds number in 'Constants' common package.

SVN: 6171
parent 7d512ba6
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package ch.systemsx.cisd.common; package ch.systemsx.cisd.common;
import org.apache.commons.lang.time.DateUtils;
/** /**
* Constants common to more than one CISD project. * Constants common to more than one CISD project.
* *
...@@ -34,4 +36,9 @@ public class Constants ...@@ -34,4 +36,9 @@ public class Constants
public static final String DELETION_IN_PROGRESS_PREFIX = public static final String DELETION_IN_PROGRESS_PREFIX =
MARKER_PREFIX + "deletion_in_progress_"; MARKER_PREFIX + "deletion_in_progress_";
/** The number of milliseconds to wait before considering timeout (<i>10s</i>). */
public static final long MILLIS_TO_WAIT_BEFORE_TIMEOUT = 10 * DateUtils.MILLIS_PER_SECOND;
/** The number of milliseconds to sleep before retrying (<i>3s</i>). */
public static final long MILLIS_TO_SLEEP_BEFORE_RETRYING = 3 * DateUtils.MILLIS_PER_SECOND;
} }
...@@ -23,6 +23,7 @@ import javax.swing.event.ChangeEvent; ...@@ -23,6 +23,7 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList; import javax.swing.event.EventListenerList;
import org.apache.commons.io.DestroyableFileSystemUtils;
import org.apache.commons.io.FileSystemUtils; import org.apache.commons.io.FileSystemUtils;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
...@@ -224,7 +225,7 @@ public final class HighwaterMarkWatcher implements Runnable ...@@ -224,7 +225,7 @@ public final class HighwaterMarkWatcher implements Runnable
public final long freeSpaceKb(final File path) throws IOException public final long freeSpaceKb(final File path) throws IOException
{ {
final String canonicalPath = FileUtilities.getCanonicalPath(path); final String canonicalPath = FileUtilities.getCanonicalPath(path);
return FileSystemUtils.freeSpaceKb(canonicalPath); return DestroyableFileSystemUtils.freeSpaceKb(canonicalPath);
} }
} }
......
...@@ -22,9 +22,9 @@ import java.util.Arrays; ...@@ -22,9 +22,9 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import ch.systemsx.cisd.common.Constants;
import ch.systemsx.cisd.common.highwatermark.HighwaterMarkWatcher.IFreeSpaceProvider; import ch.systemsx.cisd.common.highwatermark.HighwaterMarkWatcher.IFreeSpaceProvider;
import ch.systemsx.cisd.common.logging.LogCategory; import ch.systemsx.cisd.common.logging.LogCategory;
import ch.systemsx.cisd.common.logging.LogFactory; import ch.systemsx.cisd.common.logging.LogFactory;
...@@ -49,13 +49,11 @@ public final class RemoteFreeSpaceProvider implements IFreeSpaceProvider ...@@ -49,13 +49,11 @@ public final class RemoteFreeSpaceProvider implements IFreeSpaceProvider
private static final Logger operationLog = private static final Logger operationLog =
LogFactory.getLogger(LogCategory.OPERATION, RemoteFreeSpaceProvider.class); LogFactory.getLogger(LogCategory.OPERATION, RemoteFreeSpaceProvider.class);
private static final long MILLIS_TO_WAIT_FOR_COMPLETION = 2 * DateUtils.MILLIS_PER_SECOND;
private final File sshExecutable; private final File sshExecutable;
private final String host; private final String host;
private final long millisToWaitForCompletion = MILLIS_TO_WAIT_FOR_COMPLETION; private final long millisToWaitForCompletion = Constants.MILLIS_TO_WAIT_BEFORE_TIMEOUT;
public RemoteFreeSpaceProvider(final String host, final File sshExecutable) public RemoteFreeSpaceProvider(final String host, final File sshExecutable)
{ {
......
...@@ -20,6 +20,7 @@ import java.io.File; ...@@ -20,6 +20,7 @@ import java.io.File;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import ch.systemsx.cisd.common.Constants;
import ch.systemsx.cisd.common.logging.LogCategory; import ch.systemsx.cisd.common.logging.LogCategory;
import ch.systemsx.cisd.common.logging.LogFactory; import ch.systemsx.cisd.common.logging.LogFactory;
...@@ -33,8 +34,6 @@ public final class FileRenamingProcess implements IProcess ...@@ -33,8 +34,6 @@ public final class FileRenamingProcess implements IProcess
private static final Logger operationLog = private static final Logger operationLog =
LogFactory.getLogger(LogCategory.OPERATION, FileRenamingProcess.class); LogFactory.getLogger(LogCategory.OPERATION, FileRenamingProcess.class);
public static final long DEFAULT_MILLIS_TO_SLEEP = 5000L;
public static final int DEFAULT_MAX_RETRIES = 12; public static final int DEFAULT_MAX_RETRIES = 12;
private final File sourceFile; private final File sourceFile;
...@@ -51,7 +50,7 @@ public final class FileRenamingProcess implements IProcess ...@@ -51,7 +50,7 @@ public final class FileRenamingProcess implements IProcess
public FileRenamingProcess(final File sourceFile, final File destinationFile) public FileRenamingProcess(final File sourceFile, final File destinationFile)
{ {
this(DEFAULT_MAX_RETRIES, DEFAULT_MILLIS_TO_SLEEP, sourceFile, destinationFile); this(DEFAULT_MAX_RETRIES, Constants.MILLIS_TO_SLEEP_BEFORE_RETRYING, sourceFile, destinationFile);
} }
public FileRenamingProcess(final int maxRetries, final long millisToSleep, public FileRenamingProcess(final int maxRetries, final long millisToSleep,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment