You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/01/08 19:56:00 UTC
[jira] [Commented] (TRAFODION-2844) dcsserver restart mxosrvr
should have a time range
[ https://issues.apache.org/jira/browse/TRAFODION-2844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16316903#comment-16316903 ]
ASF GitHub Bot commented on TRAFODION-2844:
-------------------------------------------
Github user selvaganesang commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1344#discussion_r160235536
--- Diff: dcs/src/main/java/org/trafodion/dcs/util/RetryCounter.java ---
@@ -20,54 +20,94 @@
*/
package org.trafodion.dcs.util;
+import java.util.LinkedList;
+import java.util.Queue;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class RetryCounter {
- private static final Log LOG = LogFactory.getLog(RetryCounter.class);
- private final int maxRetries;
- private int retriesRemaining;
- private final int retryIntervalMillis;
- private final TimeUnit timeUnit;
+ private static final Log LOG = LogFactory.getLog(RetryCounter.class);
+ private final int maxRetries;
+ private int retriesRemaining;
+ private int retryInterval;
+ private Queue<Long> queue;
+ private TimeUnit timeUnit;
- public RetryCounter(int maxRetries,
- int retryIntervalMillis, TimeUnit timeUnit) {
- this.maxRetries = maxRetries;
- this.retriesRemaining = maxRetries;
- this.retryIntervalMillis = retryIntervalMillis;
- this.timeUnit = timeUnit;
- }
+ public RetryCounter(int maxRetries, int retryInterval, TimeUnit timeUnit) {
+ this.maxRetries = maxRetries;
+ this.retriesRemaining = maxRetries;
+ this.retryInterval = retryInterval;
+ this.queue = new LinkedList<Long>();
+ this.timeUnit = timeUnit;
+ }
- public int getMaxRetries() {
- return maxRetries;
- }
+ public int getMaxRetries() {
+ return maxRetries;
+ }
- /**
- * Sleep for a exponentially back off time
- * @throws InterruptedException
- */
- public void sleepUntilNextRetry() throws InterruptedException {
- int attempts = getAttemptTimes();
- long sleepTime = (long) (retryIntervalMillis * Math.log(attempts+15));
- LOG.info("Sleeping " + sleepTime + "ms before retry #" + attempts + "...");
- timeUnit.sleep(sleepTime);
- }
+ /**
+ * Sleep for a exponentially back off time
+ * @throws InterruptedException
+ */
+ public void sleepUntilNextRetry() throws InterruptedException {
+ int attempts = getAttemptTimes();
+ long sleepTime = (long) (retryInterval * Math.log(attempts + 15));
+ LOG.info("Sleeping " + sleepTime + "ms before retry #" + attempts + "...");
+ timeUnit.sleep(sleepTime);
--- End diff --
Good catch It looks like earlier the sleep time was incorrect if the TimeUnit wasn't in milliseconds.
> dcsserver restart mxosrvr should have a time range
> --------------------------------------------------
>
> Key: TRAFODION-2844
> URL: https://issues.apache.org/jira/browse/TRAFODION-2844
> Project: Apache Trafodion
> Issue Type: Bug
> Components: dcs
> Reporter: mashengchen
> Assignee: mashengchen
>
> when mxosrvr down ,dcsserver will restart it , and if mxosrvr down a lot of times in a period of time , there should reject the restart. if time between 6 times age(default setting) and this time are a very long time, dcsserver should allow the restart
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)