Examples of ExpBackoffPolicy


Examples of org.apache.falcon.rerun.policy.ExpBackoffPolicy

        Assert.assertEquals(policy.getDurationInMilliSec(frequency), 7200000);
    }

    @Test
    public void testExpBackoffPolicy() throws FalconException {
        AbstractRerunPolicy backoff = new ExpBackoffPolicy();
        long delay = backoff.getDelay(new Frequency("minutes(2)"), 2);
        Assert.assertEquals(delay, 480000);

        long currentTime = System.currentTimeMillis();
        delay = backoff.getDelay(new Frequency("minutes(2)"),
                new Date(currentTime - 1 * 4 * 60 * 1000),
                new Date(currentTime + 1 * 60 * 60 * 1000));
        Assert.assertEquals(delay, 1 * 6 * 60 * 1000);

        currentTime = System.currentTimeMillis();
        delay = backoff.getDelay(new Frequency("minutes(1)"),
                new Date(currentTime - 1 * 9 * 60 * 1000),
                new Date(currentTime + 1 * 60 * 60 * 1000));
        Assert.assertEquals(delay, 900000);
    }
View Full Code Here

Examples of org.apache.falcon.rerun.policy.ExpBackoffPolicy

    }

    @Override
    public void run() {
        int attempt = 1;
        AbstractRerunPolicy policy = new ExpBackoffPolicy();
        Frequency frequency = new Frequency("minutes(1)");
        while (true) {
            try {
                T message = null;
                try {
                    message = handler.takeFromQueue();
                    attempt = 1;
                } catch (FalconException e) {
                    LOG.error("Error while reading message from the queue: ", e);
                    GenericAlert.alertRerunConsumerFailed(
                            "Error while reading message from the queue: ", e);
                    Thread.sleep(policy.getDelay(frequency, attempt));
                    handler.reconnect();
                    attempt++;
                    continue;
                }
                String jobStatus = handler.getWfEngine().getWorkflowStatus(
View Full Code Here

Examples of org.apache.falcon.rerun.policy.ExpBackoffPolicy

    }

    @Override
    public void run() {
        int attempt = 1;
        AbstractRerunPolicy policy = new ExpBackoffPolicy();
        Frequency frequency = new Frequency("minutes(1)");
        while (true) {
            try {
                T message;
                try {
                    message = handler.takeFromQueue();
                    attempt = 1;
                } catch (FalconException e) {
                    LOG.error("Error while reading message from the queue: ", e);
                    GenericAlert.alertRerunConsumerFailed(
                            "Error while reading message from the queue: ", e);
                    Thread.sleep(policy.getDelay(frequency, attempt));
                    handler.reconnect();
                    attempt++;
                    continue;
                }
View Full Code Here

Examples of org.apache.ivory.rerun.policy.ExpBackoffPolicy

    Assert.assertEquals(policy.getDurationInMilliSec(frequency), 7200000);
  }

  @Test
  public void TestExpBackoffPolicy() throws IvoryException {
    AbstractRerunPolicy backoff = new ExpBackoffPolicy();
    long delay = backoff.getDelay(new Frequency("minutes(2)"), 2);
    Assert.assertEquals(delay, 480000);

    long currentTime = System.currentTimeMillis();
    delay = backoff.getDelay(new Frequency("minutes(2)"), new Date(
        currentTime - 1 * 4 * 60 * 1000), new Date(currentTime + 1 * 60
        * 60 * 1000));
    Assert.assertEquals(delay, 1 * 6 * 60 * 1000);
   
    currentTime = System.currentTimeMillis();
    delay = backoff.getDelay(new Frequency("minutes(1)"), new Date(
        currentTime - 1 * 9 * 60 * 1000), new Date(currentTime + 1 * 60
        * 60 * 1000));
    Assert.assertEquals(delay, 900000);
  }
View Full Code Here

Examples of org.apache.ivory.rerun.policy.ExpBackoffPolicy

  }

  @Override
  public void run() {
    int attempt = 1;
    AbstractRerunPolicy policy = new ExpBackoffPolicy();
    Frequency frequency = new Frequency("minutes(1)");
    while (true) {
      try {
        T message = null;
        try {
          message = handler.takeFromQueue();
          attempt = 1;
        } catch (IvoryException e) {
          LOG.error("Error while reading message from the queue: ", e);
          GenericAlert.alertRerunConsumerFailed(
              "Error while reading message from the queue: ", e);
          Thread.sleep(policy.getDelay(frequency, attempt));
          handler.reconnect();
          attempt++;
          continue;
        }
        String jobStatus = handler.getWfEngine().getWorkflowStatus(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.