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