Skip to content
Snippets Groups Projects
Commit 2712e492 authored by jakubs's avatar jakubs
Browse files

refactor recovery properties to the single place

SVN: 26686
parent f860776f
No related merge requests found
......@@ -113,6 +113,14 @@ public final class ThreadParameters
public static final String PROCESS_RETRY_PAUSE_IN_SEC = "process-retry-pause-in-sec";
/*
* Recovery related properties
*/
public static final String RECOVERY_MAX_RETRY_COUNT = "recovery-max-retry-count";
public static final String RECOVERY_MIN_RETRY_PERIOD = "recovery-min-retry-period";
/**
* The (local) directory to monitor for new files and directories to move to the remote side.
* The directory where data to be processed by the ETL server become available.
......@@ -151,6 +159,10 @@ public final class ThreadParameters
private final int processRetryPauseInSec;
private final int maximumRecoveryCount;
private final int minimumRecoveryPeriod;
private final DataSetRegistrationPreStagingBehavior dataSetRegistrationPreStagingBehavior;
/**
......@@ -200,17 +212,21 @@ public final class ThreadParameters
"6"));
this.dataSetRegistrationRetryPauseInSec =
Integer.parseInt(threadProperties.getProperty(DATASET_REGISTRATION_RETRY_PAUSE_IN_SEC,
"300"));
Integer.parseInt(threadProperties.getProperty(
DATASET_REGISTRATION_RETRY_PAUSE_IN_SEC, "300"));
this.processMaxRetryCount =
Integer.parseInt(threadProperties.getProperty(PROCESS_MAX_RETRY_COUNT,
"6"));
Integer.parseInt(threadProperties.getProperty(PROCESS_MAX_RETRY_COUNT, "6"));
this.processRetryPauseInSec =
Integer.parseInt(threadProperties.getProperty(PROCESS_RETRY_PAUSE_IN_SEC,
"300"));
Integer.parseInt(threadProperties.getProperty(PROCESS_RETRY_PAUSE_IN_SEC, "300"));
this.maximumRecoveryCount =
PropertyUtils.getInt(threadProperties, RECOVERY_MAX_RETRY_COUNT, 50);
this.minimumRecoveryPeriod =
PropertyUtils.getInt(threadProperties, RECOVERY_MIN_RETRY_PERIOD, 60);
this.threadName = threadName;
String onErrorClassName =
......@@ -477,4 +493,13 @@ public final class ThreadParameters
return processRetryPauseInSec;
}
public int getMaximumRecoveryCount()
{
return maximumRecoveryCount;
}
public int getMinimumRecoveryPeriod()
{
return minimumRecoveryPeriod;
}
}
......@@ -156,11 +156,11 @@ public class TopLevelDataSetRegistratorGlobalState implements IResource
this.storageRecoveryManager = storageRecoveryManager;
this.storageRecoveryManager.setDropboxRecoveryStateDir(this.recoveryStateDir);
this.storageRecoveryManager.setRecoveryMarkerFilesDir(recoveryMarkerFilesDirectory);
this.storageRecoveryManager.setMaximumRertyCount(getMaximumRecoveryCount(threadParameters
.getThreadProperties()));
this.storageRecoveryManager
.setRetryPeriodInSeconds(getMinimumRecoveryPeriod(threadParameters
.getThreadProperties()));
.setMaximumRertyCount(threadParameters.getMaximumRecoveryCount());
this.storageRecoveryManager
.setRetryPeriodInSeconds(threadParameters
.getMinimumRecoveryPeriod());
// Initialize the DSS Registration Log Directory
new DssRegistrationLogDirectoryHelper(dssRegistrationLogDir).initializeSubdirectories();
......@@ -310,6 +310,10 @@ public class TopLevelDataSetRegistratorGlobalState implements IResource
return storageRecoveryManager;
}
/*
* Properties that control the location of directories. Other properties are rather more
* suitable in ThreadParameters
*/
public static final String STAGING_DIR = "staging-dir";
public static final String PRE_STAGING_DIR = "pre-staging-dir";
......@@ -318,10 +322,6 @@ public class TopLevelDataSetRegistratorGlobalState implements IResource
public static final String RECOVERY_MARKER_DIR = "recovery-marker-dir";
public static final String RECOVERY_MAX_RETRY_COUNT = "recovery-max-retry-count";
public static final String RECOVERY_MIN_RETRY_PERIOD = "recovery-min-retry-period";
private static File getStagingDir(File storeRoot, String shareId, Properties threadProperties)
{
return getShareLocalDir(storeRoot, shareId, threadProperties, STAGING_DIR, "staging");
......@@ -345,16 +345,6 @@ public class TopLevelDataSetRegistratorGlobalState implements IResource
"recovery-marker");
}
private static int getMaximumRecoveryCount(Properties threadProperties)
{
return PropertyUtils.getInt(threadProperties, RECOVERY_MAX_RETRY_COUNT, 50);
}
private static int getMinimumRecoveryPeriod(Properties threadProperties)
{
return PropertyUtils.getInt(threadProperties, RECOVERY_MIN_RETRY_PERIOD, 60);
}
/**
* Get a directory local to the share, respecting the user override, if one is specified, and
* defaulting to the defaultDirName.
......
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