@@ -1221,11 +1221,21 @@ else if (conf.max_value_size.toMebibytes() >= 2048)
12211221 if (conf .audit_logging_options != null )
12221222 setAuditLoggingOptions (conf .audit_logging_options );
12231223
1224- // just run through the validation by setting current values back to their setters, so we are sure that their values are valid
1225- DatabaseDescriptor .setGCLogThreshold ((int ) DatabaseDescriptor .getGCLogThreshold ());
1226- DatabaseDescriptor .setGCWarnThreshold ((int ) DatabaseDescriptor .getGCWarnThreshold ());
1227- DatabaseDescriptor .setGCConcurrentPhaseLogThreshold (DatabaseDescriptor .getGCConcurrentPhaseLogThreshold ());
1228- DatabaseDescriptor .setGCConcurrentPhaseWarnThreshold (DatabaseDescriptor .getGCConcurrentPhaseWarnThreshold ());
1224+ try
1225+ {
1226+ // Run through the validation by setting current values back to their setters, so we are sure that their values are valid.
1227+ // We are catching IllegalArgumentException and translating it to ConfigurationException to comply with
1228+ // rest of the logic in this method. These setters are also called in GCInspectorMXBean were IllegalArgumentException
1229+ // is thrown when arguments are invalid instead ConfigurationException, on purpose.
1230+ DatabaseDescriptor .setGCLogThreshold ((int ) DatabaseDescriptor .getGCLogThreshold ());
1231+ DatabaseDescriptor .setGCWarnThreshold ((int ) DatabaseDescriptor .getGCWarnThreshold ());
1232+ DatabaseDescriptor .setGCConcurrentPhaseLogThreshold (DatabaseDescriptor .getGCConcurrentPhaseLogThreshold ());
1233+ DatabaseDescriptor .setGCConcurrentPhaseWarnThreshold (DatabaseDescriptor .getGCConcurrentPhaseWarnThreshold ());
1234+ }
1235+ catch (IllegalArgumentException ex )
1236+ {
1237+ throw new ConfigurationException (ex .getMessage ());
1238+ }
12291239 }
12301240
12311241 @ VisibleForTesting
@@ -4728,12 +4738,12 @@ public static long getGCLogThreshold()
47284738 public static void setGCLogThreshold (int threshold )
47294739 {
47304740 if (threshold <= 0 )
4731- throw new ConfigurationException ("Threshold value for gc_log_threshold must be greater than 0" );
4741+ throw new IllegalArgumentException ("Threshold value for gc_log_threshold must be greater than 0" );
47324742
47334743 long gcWarnThresholdInMs = getGCWarnThreshold ();
47344744 if (gcWarnThresholdInMs != 0 && threshold > gcWarnThresholdInMs )
4735- throw new ConfigurationException ("Threshold value for gc_log_threshold (" + threshold + ") must be less than gc_warn_threshold which is currently "
4736- + gcWarnThresholdInMs );
4745+ throw new IllegalArgumentException ("Threshold value for gc_log_threshold (" + threshold + ") must be less than gc_warn_threshold which is currently "
4746+ + gcWarnThresholdInMs );
47374747
47384748 conf .gc_log_threshold = new DurationSpec .IntMillisecondsBound (threshold );
47394749 }
@@ -4746,12 +4756,12 @@ public static long getGCWarnThreshold()
47464756 public static void setGCWarnThreshold (int threshold )
47474757 {
47484758 if (threshold < 0 )
4749- throw new ConfigurationException ("Threshold value for gc_warn_threshold must be greater than or equal to 0" );
4759+ throw new IllegalArgumentException ("Threshold value for gc_warn_threshold must be greater than or equal to 0" );
47504760
47514761 long gcLogThresholdInMs = getGCLogThreshold ();
47524762 if (threshold != 0 && threshold <= gcLogThresholdInMs )
4753- throw new ConfigurationException ("Threshold value for gc_warn_threshold (" + threshold + ") must be greater than gc_log_threshold which is currently "
4754- + gcLogThresholdInMs );
4763+ throw new IllegalArgumentException ("Threshold value for gc_warn_threshold (" + threshold + ") must be greater than gc_log_threshold which is currently "
4764+ + gcLogThresholdInMs );
47554765
47564766 conf .gc_warn_threshold = new DurationSpec .IntMillisecondsBound (threshold );
47574767 }
@@ -4764,12 +4774,12 @@ public static int getGCConcurrentPhaseLogThreshold()
47644774 public static void setGCConcurrentPhaseLogThreshold (int threshold )
47654775 {
47664776 if (threshold <= 0 )
4767- throw new ConfigurationException ("Threshold must be greater than 0" );
4777+ throw new IllegalArgumentException ("Threshold must be greater than 0" );
47684778
47694779 long gcConcurrentPhaseWarnThresholdInMs = getGCConcurrentPhaseWarnThreshold ();
47704780 if (gcConcurrentPhaseWarnThresholdInMs != 0 && threshold > gcConcurrentPhaseWarnThresholdInMs )
4771- throw new ConfigurationException ("Threshold value for gc_concurrent_phase_log_threshold (" + threshold + ") must be less than gc_concurrent_phase_warn_threshold which is currently "
4772- + gcConcurrentPhaseWarnThresholdInMs );
4781+ throw new IllegalArgumentException ("Threshold value for gc_concurrent_phase_log_threshold (" + threshold + ") must be less than gc_concurrent_phase_warn_threshold which is currently "
4782+ + gcConcurrentPhaseWarnThresholdInMs );
47734783
47744784 conf .gc_concurrent_phase_log_threshold = new DurationSpec .IntMillisecondsBound (threshold );
47754785 }
@@ -4782,12 +4792,12 @@ public static int getGCConcurrentPhaseWarnThreshold()
47824792 public static void setGCConcurrentPhaseWarnThreshold (int threshold )
47834793 {
47844794 if (threshold < 0 )
4785- throw new ConfigurationException ("Threshold value for gc_concurrent_phase_warn_threshold must be greater than or equal to 0" );
4795+ throw new IllegalArgumentException ("Threshold value for gc_concurrent_phase_warn_threshold must be greater than or equal to 0" );
47864796
47874797 long gcConcurrentPhaseLogThresholdInMs = getGCConcurrentPhaseLogThreshold ();
47884798 if (threshold != 0 && threshold <= gcConcurrentPhaseLogThresholdInMs )
4789- throw new ConfigurationException ("Threshold value for gc_concurrent_phase_warn_threshold (" + threshold + ") must be greater than gc_concurrent_phase_log_threshold which is currently "
4790- + gcConcurrentPhaseLogThresholdInMs );
4799+ throw new IllegalArgumentException ("Threshold value for gc_concurrent_phase_warn_threshold (" + threshold + ") must be greater than gc_concurrent_phase_log_threshold which is currently "
4800+ + gcConcurrentPhaseLogThresholdInMs );
47914801
47924802 conf .gc_concurrent_phase_warn_threshold = new DurationSpec .IntMillisecondsBound (threshold );
47934803 }
0 commit comments