View Javadoc

1   /*
2    * $Id: RetryForeverPolicyTemplate.java 22088 2011-06-03 10:07:47Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.retry.policies;
12  
13  import org.mule.api.retry.RetryPolicy;
14  
15  /**
16   * This policy is the same as {@link SimpleRetryPolicyTemplate} but will retry an infinite amount of times.
17   */
18  public class RetryForeverPolicyTemplate extends SimpleRetryPolicyTemplate
19  {
20      public RetryForeverPolicyTemplate()
21      {
22          super();
23      }
24  
25      public RetryForeverPolicyTemplate(long frequency)
26      {
27          this.frequency = frequency;
28      }
29  
30      @Override
31      public RetryPolicy createRetryInstance()
32      {
33          return new SimpleRetryPolicy(frequency, RETRY_COUNT_FOREVER);
34      }
35  
36      @Override
37      public String toString()
38      {
39          final StringBuffer sb = new StringBuffer();
40          sb.append("RetryForeverPolicy");
41          sb.append("{frequency=").append(frequency);
42          sb.append('}');
43          return sb.toString();
44      }
45  }