Skip to content
Snippets Groups Projects
Commit 73042ccf authored by brinn's avatar brinn
Browse files

add: feature to change the interval for the internal timer tasks separately...

add: feature to change the interval for the internal timer tasks separately from the external interval and set it by default to 10 seconds.
change: default of external interval from 120 seconds to 60 seconds

SVN: 1948
parent b39d294b
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,7 @@ prefix-for-incoming = %t_
# outgoing-host = <host where the outgoing directory is located (specify only when using an ssh tunnel)>
# incoming-host = <host where the incoming directory is located (specify only when using an ssh tunnel)>
# check-interval = <time interval between two checks in seconds>
# check-interval-internal = <time interval between two checks for the internal queues in seconds>
# inactivity-period = <time period before a copy process is considered stalled in seconds>
# quiet-period = <time period that a path (file or directory) in incoming is required to be "quiet" before it is copied in seconds>
# failure-interval = <time interval to wait after a failure before the operation is re-tried in seconds>
......
......@@ -93,8 +93,9 @@ public class DataMover
final DataMoverProcess localProcessor = createLocalProcessor();
final DataMoverProcess incomingProcess = createIncomingMovingProcess();
final ITerminable recoveryProcess = startupRecoveryProcess(localProcessor, incomingProcess);
outgoingMovingProcess.startup(0L, parameters.getCheckIntervalMillis());
localProcessor.startup(parameters.getCheckIntervalMillis() / 2L, parameters.getCheckIntervalMillis());
outgoingMovingProcess.startup(0L, parameters.getCheckIntervalInternalMillis());
localProcessor.startup(parameters.getCheckIntervalInternalMillis() / 2L, parameters
.getCheckIntervalInternalMillis());
incomingProcess.startup(0L, parameters.getCheckIntervalMillis());
return createCompoundTerminable(recoveryProcess, outgoingMovingProcess, localProcessor, incomingProcess);
}
......
......@@ -78,15 +78,27 @@ public class Parameters implements ITimingParameters, IFileSysParameters
/**
* Default interval to wait between two checks for activity (in seconds)
*/
static final int DEFAULT_CHECK_INTERVAL = 120;
static final int DEFAULT_CHECK_INTERVAL = 60;
/**
* The interval to wait between two checks for activity (in milliseconds).
*/
@Option(name = "c", longName = "check-interval", usage = "The interval to wait between two checks (in seconds) "
+ "[default: 120]", handler = MillisecondConversionOptionHandler.class)
+ "[default: 160]", handler = MillisecondConversionOptionHandler.class)
private long checkIntervalMillis;
/**
* Default interval to wait between two checks for activity for the internal processing queues (in seconds)
*/
static final int DEFAULT_CHECK_INTERVAL_INTERNAL = 10;
/**
* The interval to wait between two checks for activity for the internal processing queues (in milliseconds).
*/
@Option(longName = "check-interval-internal", usage = "The interval to wait between two checks for the internal processing queues (in seconds) "
+ "[default: 10]", handler = MillisecondConversionOptionHandler.class)
private long checkIntervalInternalMillis;
/**
* Default period to wait before a file or directory is considered "inactive" or "stalled" (in seconds).
*/
......@@ -362,6 +374,9 @@ public class Parameters implements ITimingParameters, IFileSysParameters
checkIntervalMillis =
Integer.parseInt(serviceProperties.getProperty("check-interval", Integer
.toString(DEFAULT_CHECK_INTERVAL))) * 1000;
checkIntervalInternalMillis =
Integer.parseInt(serviceProperties.getProperty("check-interval-internal", Integer
.toString(DEFAULT_CHECK_INTERVAL_INTERNAL))) * 1000;
inactivityPeriodMillis =
Integer.parseInt(serviceProperties.getProperty("inactivity-period", Integer
.toString(DEFAULT_INACTIVITY_PERIOD))) * 1000;
......@@ -462,13 +477,21 @@ public class Parameters implements ITimingParameters, IFileSysParameters
}
/**
* @return The interval to wait beween to checks for activity (in milliseconds).
* @return The interval to wait between two checks for activity (in milliseconds).
*/
public long getCheckIntervalMillis()
{
return checkIntervalMillis;
}
/**
* @return The interval to wait between two checks for activity for the internal threads (in milliseconds).
*/
public long getCheckIntervalInternalMillis()
{
return checkIntervalInternalMillis;
}
/**
* @return The period to wait before a file or directory is considered "inactive" (in milliseconds). This setting is
* used when deciding whether a copy operation of a file or directory is "stalled".
......@@ -622,7 +645,9 @@ public class Parameters implements ITimingParameters, IFileSysParameters
{
operationLog.info(String.format("Extra copy directory: '%s'.", extraCopyDirectory.getAbsolutePath()));
}
operationLog.info(String.format("Check intervall: %d s.", getCheckIntervalMillis() / 1000));
operationLog.info(String.format("Check intervall (external): %d s.", getCheckIntervalMillis() / 1000));
operationLog.info(String.format("Check intervall (internal): %d s.",
getCheckIntervalInternalMillis() / 1000));
operationLog.info(String.format("Quiet period: %d s.", getQuietPeriodMillis() / 1000));
operationLog.info(String.format("Inactivity (stall) period: %d s.", getInactivityPeriodMillis() / 1000));
operationLog.info(String.format("Intervall to wait after failure: %d s.",
......
......@@ -55,6 +55,8 @@ public class MainTest
private static final int CHECK_INTERVAL = 1;
private static final int CHECK_INTERVAL_INTERNAL = 1;
private static final int QUIET_PERIOD = 2;
private static final File unitTestRootDirectory = new File("targets" + File.separator + "unit-test-wd");
......@@ -205,6 +207,7 @@ public class MainTest
{
return createList("--incoming-dir", dirs.incoming.getPath(), "--buffer-dir", dirs.buffer.getPath(),
"--outgoing-dir", dirs.outgoing.getPath(), "--check-interval", Integer.toString(CHECK_INTERVAL),
"--check-interval-internal", Integer.toString(CHECK_INTERVAL_INTERNAL),
"--quiet-period", Integer.toString(QUIET_PERIOD), "--treat-incoming-as-remote");
}
......
......@@ -130,6 +130,13 @@ public class ParametersTest
assertEquals(1000 * Parameters.DEFAULT_CHECK_INTERVAL, parameters.getCheckIntervalMillis());
}
@Test
public void testDefaultCheckIntervalInternal() throws Exception
{
final Parameters parameters = parse();
assertEquals(1000 * Parameters.DEFAULT_CHECK_INTERVAL_INTERNAL, parameters.getCheckIntervalInternalMillis());
}
@Test
public void testDefaultQuietPeriod() throws Exception
{
......@@ -181,6 +188,14 @@ public class ParametersTest
assertEquals(1000 * CHECK_INTERVAL, parameters.getCheckIntervalMillis());
}
@Test
public void testSetCheckIntervalInternalLong() throws Exception
{
final int CHECK_INTERVAL = 1;
final Parameters parameters = parse("--check-interval-internal", Integer.toString(CHECK_INTERVAL));
assertEquals(1000 * CHECK_INTERVAL, parameters.getCheckIntervalInternalMillis());
}
@Test
public void testDefaultQuietInterval() throws Exception
{
......
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