From 2712e4926445763672d47994d89f6181ab300b51 Mon Sep 17 00:00:00 2001 From: jakubs <jakubs> Date: Wed, 19 Sep 2012 15:00:47 +0000 Subject: [PATCH] refactor recovery properties to the single place SVN: 26686 --- .../cisd/etlserver/ThreadParameters.java | 39 +++++++++++++++---- ...TopLevelDataSetRegistratorGlobalState.java | 26 ++++--------- 2 files changed, 40 insertions(+), 25 deletions(-) diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/ThreadParameters.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/ThreadParameters.java index 1b3269f65c0..af4e72a1215 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/ThreadParameters.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/ThreadParameters.java @@ -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; + } } diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/TopLevelDataSetRegistratorGlobalState.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/TopLevelDataSetRegistratorGlobalState.java index fbb890c2cf9..cadf696858a 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/TopLevelDataSetRegistratorGlobalState.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/TopLevelDataSetRegistratorGlobalState.java @@ -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. -- GitLab