RefillFactory.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace refill;
  3. require_once(BASE_HELPER_PATH . '/refill/RefillBase.php');
  4. use Log;
  5. use StatesHelper;
  6. class RefillFactory extends RefillBase
  7. {
  8. private static $stInstance = null;
  9. public static function instance()
  10. {
  11. if (self::$stInstance == null) {
  12. self::$stInstance = new RefillFactory();
  13. }
  14. if(defined('SUPPORT_PTHREAD') && SUPPORT_PTHREAD === true)
  15. {
  16. Log::record("MOBILE_SERVER defined call load",Log::DEBUG);
  17. if(StatesHelper::fetch_state('channel')) {
  18. Log::record("RefillFactory reload channel config.",Log::DEBUG);
  19. self::$stInstance->load();
  20. }
  21. }
  22. return self::$stInstance;
  23. }
  24. private function __construct()
  25. {
  26. if (defined('SUPPORT_PTHREAD') && SUPPORT_PTHREAD === false) {
  27. Log::record("SUPPORT_PTHREAD defined dont call load",Log::DEBUG);
  28. } else {
  29. Log::record("SUPPORT_PTHREAD has not defined and call load",Log::DEBUG);
  30. $this->load();
  31. }
  32. }
  33. }