RetryPolicyAbstract.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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: RetryPolicy.php 28585 2009-09-07 12:12:56Z unknown $
  19. * @copyright Copyright (c) 2005-2009 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_Exception
  24. */
  25. require_once 'Zend/Service/WindowsAzure/Exception.php';
  26. /**
  27. * @see Zend_Service_WindowsAzure_RetryPolicy_NoRetry
  28. */
  29. require_once 'Zend/Service/WindowsAzure/RetryPolicy/NoRetry.php';
  30. /**
  31. * @see Zend_Service_WindowsAzure_RetryPolicy_RetryN
  32. */
  33. require_once 'Zend/Service/WindowsAzure/RetryPolicy/RetryN.php';
  34. /**
  35. * @category Zend
  36. * @package Zend_Service_WindowsAzure
  37. * @subpackage RetryPolicy
  38. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  39. * @license http://framework.zend.com/license/new-bsd New BSD License
  40. */
  41. abstract class Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract
  42. {
  43. /**
  44. * Execute function under retry policy
  45. *
  46. * @param string|array $function Function to execute
  47. * @param array $parameters Parameters for function call
  48. * @return mixed
  49. */
  50. public abstract function execute($function, $parameters = array());
  51. /**
  52. * Create a Zend_Service_WindowsAzure_RetryPolicy_NoRetry instance
  53. *
  54. * @return Zend_Service_WindowsAzure_RetryPolicy_NoRetry
  55. */
  56. public static function noRetry()
  57. {
  58. return new Zend_Service_WindowsAzure_RetryPolicy_NoRetry();
  59. }
  60. /**
  61. * Create a Zend_Service_WindowsAzure_RetryPolicy_RetryN instance
  62. *
  63. * @param int $count Number of retries
  64. * @param int $intervalBetweenRetries Interval between retries (in milliseconds)
  65. * @return Zend_Service_WindowsAzure_RetryPolicy_RetryN
  66. */
  67. public static function retryN($count = 1, $intervalBetweenRetries = 0)
  68. {
  69. return new Zend_Service_WindowsAzure_RetryPolicy_RetryN($count, $intervalBetweenRetries);
  70. }
  71. }