@Test public void testValid() throws Exception { RetryPolicy policy = RetryPolicyFactory.create("1:[1,2]"); assertTrue(policy instanceof FrequencySpecifiedRetryPolicy); assertEquals(2, policy.getRetryTimes()); }
public static RetryPolicy create(String policyValue) { if (policyValue != null) { RetryPolicy policy = m_cache.get(policyValue); if (policy == null) { synchronized (m_cache) { policy = m_cache.get(policyValue); if (policy == null) { policy = createPolicy(policyValue); m_cache.put(policyValue, policy); } } } if (policy != null) { return policy; } } throw new IllegalArgumentException(String.format("Unknown retry policy for value %s", policyValue)); }
RetryPolicyFactory { public static RetryPolicy create(String policyValue) { if (policyValue != null) { RetryPolicy policy = m_cache.get(policyValue); if (policy == null) { synchronized (m_cache) { policy = m_cache.get(policyValue); if (policy == null) { policy = createPolicy(policyValue); m_cache.put(policyValue, policy); } } } if (policy != null) { return policy; } } throw new IllegalArgumentException(String.format("Unknown retry policy for value %s", policyValue)); } }
RetryPolicyFactory { public static RetryPolicy create(String policyValue) { if (policyValue != null) { RetryPolicy policy = m_cache.get(policyValue); if (policy == null) { synchronized (m_cache) { policy = m_cache.get(policyValue); if (policy == null) { policy = createPolicy(policyValue); m_cache.put(policyValue, policy); } } } if (policy != null) { return policy; } } throw new IllegalArgumentException(String.format("Unknown retry policy for value %s", policyValue)); }  }
RetryPolicyFactory { public static RetryPolicy create(String policyValue) { if (policyValue != null) { RetryPolicy policy = m_cache.get(policyValue); if (policy == null) { synchronized (m_cache) { policy = m_cache.get(policyValue); if (policy == null) { policy = createPolicy(policyValue); m_cache.put(policyValue, policy); } } } if (policy != null) { return policy; } } throw new IllegalArgumentException(String.format("Unknown retry policy for value %s", policyValue)); }  static RetryPolicy create(String policyValue); }
RetryPolicyFactory { public static RetryPolicy create(String policyValue) { if (policyValue != null) { RetryPolicy policy = m_cache.get(policyValue); if (policy == null) { synchronized (m_cache) { policy = m_cache.get(policyValue); if (policy == null) { policy = createPolicy(policyValue); m_cache.put(policyValue, policy); } } } if (policy != null) { return policy; } } throw new IllegalArgumentException(String.format("Unknown retry policy for value %s", policyValue)); }  static RetryPolicy create(String policyValue);  }