RetryPolicyAbstract.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Service_WindowsAzure
  17. * @subpackage RetryPolicy
  18. * @version $Id$
  19. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  20. * @license http://framework.zend.com/license/new-bsd New BSD License
  21. */
  22. /**
  23. * @see Zend_Service_WindowsAzure_RetryPolicy_NoRetry
  24. */
  25. require_once 'Zend/Service/WindowsAzure/RetryPolicy/NoRetry.php';
  26. /**
  27. * @see Zend_Service_WindowsAzure_RetryPolicy_RetryN
  28. */
  29. require_once 'Zend/Service/WindowsAzure/RetryPolicy/RetryN.php';
  30. /**
  31. * @category Zend
  32. * @package Zend_Service_WindowsAzure
  33. * @subpackage RetryPolicy
  34. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  35. * @license http://framework.zend.com/license/new-bsd New BSD License
  36. */
  37. abstract class Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract
  38. {
  39. /**
  40. * Execute function under retry policy
  41. *
  42. * @param string|array $function Function to execute
  43. * @param array $parameters Parameters for function call
  44. * @return mixed
  45. */
  46. public abstract function execute($function, $parameters = array());
  47. /**
  48. * Create a Zend_Service_WindowsAzure_RetryPolicy_NoRetry instance
  49. *
  50. * @return Zend_Service_WindowsAzure_RetryPolicy_NoRetry
  51. */
  52. public static function noRetry()
  53. {
  54. return new Zend_Service_WindowsAzure_RetryPolicy_NoRetry();
  55. }
  56. /**
  57. * Create a Zend_Service_WindowsAzure_RetryPolicy_RetryN instance
  58. *
  59. * @param int $count Number of retries
  60. * @param int $intervalBetweenRetries Interval between retries (in milliseconds)
  61. * @return Zend_Service_WindowsAzure_RetryPolicy_RetryN
  62. */
  63. public static function retryN($count = 1, $intervalBetweenRetries = 0)
  64. {
  65. return new Zend_Service_WindowsAzure_RetryPolicy_RetryN($count, $intervalBetweenRetries);
  66. }
  67. }