From 042cc714b875738a4f224efe8b2c0f8ba9c5b7ef Mon Sep 17 00:00:00 2001 From: Shane Harter Date: Tue, 13 Nov 2012 11:41:18 -0800 Subject: [PATCH 1/9] Update README.md --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 467f536..ccea70c 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,13 @@ Create solid, long-running PHP daemon processes by extending the Core_Daemon cla * A POSIX compatible operating system (Linux, OSX, BSD) * POSIX and PCNTL Extensions for PHP -#### Changes in 2.0: -* Create asynchronous background workers with the new Worker API. See the `PrimeNumbers` example application or the Wiki. -* Hook into a simple callback system using familiar `on(event, callable)` & `off()` syntax. Built-in events give you the ability to hook into application state changes, or make your own to create a simple message bus for your application. -* Create event loops that are not timer-based (build socket-servers, or use blocking system calls with ease) -* Dozens of additional enhancements and bug fixes. +#### [NEW] Version 2.1 Beta Testing +* Version 2.1 is currently being developed in the branch `feature_abstract_ipc`. It's currently at alpha and a formal beta will be announced soon. +* Exciting features in 2.1 include: + * A new Socket Server plugin that lets you create event-driven async servers in a few lines of code. + * A major refactoring of the Worker API includes pluggable IPC classes: Channel worker communication over any popular message queue or stick with the built-in SysV channel. * Improved, simpler worker debug shell with new, powerful commands and easier integration of custom breakpoints into your own worker code. + * Centralize all the process forking, reaping and management code spread around the `Core_Daemon` and `Core_Worker_Mediator` classes into a simple ProcessManager plugin. + * Dozens of other bug fixes and improvements towards simpler, clearer code in the core Daemon and Mediator classes. #### Support & Consulting * Commercial support & consulting is available, including on-site support in the San Francisco Bay Area. From 72c208ef269fd3e41bb76ae025ccb3e54d9453a2 Mon Sep 17 00:00:00 2001 From: Shane Harter Date: Tue, 13 Nov 2012 11:43:04 -0800 Subject: [PATCH 2/9] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ccea70c..4b26313 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,10 @@ Create solid, long-running PHP daemon processes by extending the Core_Daemon cla #### [NEW] Version 2.1 Beta Testing * Version 2.1 is currently being developed in the branch `feature_abstract_ipc`. It's currently at alpha and a formal beta will be announced soon. -* Exciting features in 2.1 include: +* Exciting features in 2.1 include: * A new Socket Server plugin that lets you create event-driven async servers in a few lines of code. - * A major refactoring of the Worker API includes pluggable IPC classes: Channel worker communication over any popular message queue or stick with the built-in SysV channel. * Improved, simpler worker debug shell with new, powerful commands and easier integration of custom breakpoints into your own worker code. + * A major refactoring of the Worker API includes pluggable IPC classes: Channel worker communication over any popular message queue or stick with the built-in SysV channel. + * Improved, simpler worker debug shell with new, powerful commands and easier integration of custom breakpoints into your own worker code. * Centralize all the process forking, reaping and management code spread around the `Core_Daemon` and `Core_Worker_Mediator` classes into a simple ProcessManager plugin. * Dozens of other bug fixes and improvements towards simpler, clearer code in the core Daemon and Mediator classes. From 5cfe5ffddb381ad38158f156496f10e66a860146 Mon Sep 17 00:00:00 2001 From: brunnels Date: Fri, 2 May 2014 05:41:10 -0500 Subject: [PATCH 3/9] Added fix for fatal error during worker cleanup Added running_count method to Mediator --- Core/Worker/Mediator.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Core/Worker/Mediator.php b/Core/Worker/Mediator.php index 70e40eb..900b7a5 100644 --- a/Core/Worker/Mediator.php +++ b/Core/Worker/Mediator.php @@ -721,7 +721,9 @@ public function run() { $this->log("Enforcing Timeout on Call $call_id in pid " . $call->pid); - $this->process($call->pid)->kill(); + if($this->process($call->pid) instanceof Core_Lib_Process) { + $this->process($call->pid)->kill(); + } $call->timeout(); unset($this->running_calls[$call_id]); @@ -997,6 +999,14 @@ public function process_count() { return 0; } + /** + * Retrieves the number of worker processes that are currently running + * + * @return number + */ + public function running_count() { + return count($this->running_calls); + } /** * Dump runtime stats in tabular fashion to the log. From 776750a5db500c2104713ebc31a2024138bb1508 Mon Sep 17 00:00:00 2001 From: soulhunter1987 Date: Sun, 4 May 2014 00:05:19 +0300 Subject: [PATCH 4/9] Move getopt() out of object constructor to allow exceptions in it --- Core/Daemon.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Daemon.php b/Core/Daemon.php index 86f8e7a..005d9a5 100755 --- a/Core/Daemon.php +++ b/Core/Daemon.php @@ -193,6 +193,7 @@ public static function getInstance() try { $o = new static; + $o->getopt(); $o->setup_plugins(); $o->setup_workers(); $o->check_environment(); @@ -249,7 +250,6 @@ protected function __construct() $this->set('filename', $argv[0]); $this->set('start_time', time()); $this->pid(getmypid()); - $this->getopt(); } /** From e7368d283a04a80995abcb9c497b58b95bf07db7 Mon Sep 17 00:00:00 2001 From: soulhunter1987 Date: Sun, 4 May 2014 00:55:27 +0300 Subject: [PATCH 5/9] Remove Lock plugin TTL capabilities as outdated Fix Memcache lib Refactore Lock plugins code to be more eficient --- Core/Lib/Memcache.php | 24 ++++++++++---------- Core/Lock/File.php | 29 +++++------------------- Core/Lock/Lock.php | 49 +++++++++++++++++++++++------------------ Core/Lock/Memcached.php | 27 +++++++---------------- Core/Lock/Shm.php | 22 +++++------------- 5 files changed, 59 insertions(+), 92 deletions(-) diff --git a/Core/Lib/Memcache.php b/Core/Lib/Memcache.php index af3d8e3..8c93e48 100755 --- a/Core/Lib/Memcache.php +++ b/Core/Lib/Memcache.php @@ -64,7 +64,7 @@ public function ns($namespace = null) * @param integer $timeout_override The retry timeout in seconds * @return mixed The value from Memcache or False */ - public function getWithRetry($key, $flags = false, $timeout_override = false) + public function getWithRetry($key, $timeout_override = false) { if ($timeout_override) $max_tries = intval($timeout_override / 0.10); @@ -76,7 +76,7 @@ public function getWithRetry($key, $flags = false, $timeout_override = false) for ($i=0; $i<$max_tries; $i++) { - $value = $this->get($key, $flags); + $value = $this->get($key); if(false == empty($value)) return $value; @@ -94,7 +94,7 @@ public function getWithRetry($key, $flags = false, $timeout_override = false) * @param integer $expire * @return boolean */ - public function set($key, $var, $flags = null, $expire = null) + public function set($key, $var, $expire = 0) { if ($this->auto_retry) $max_tries = intval($this->auto_retry_timeout / 0.10); @@ -106,7 +106,7 @@ public function set($key, $var, $flags = null, $expire = null) for ($i=0; $i<$max_tries; $i++) { - if(parent::set($this->key($key), $var, $flags, $expire)) + if(parent::set($this->key($key), $var, $expire)) return true; usleep(100000); @@ -121,19 +121,19 @@ public function set($key, $var, $flags = null, $expire = null) * @param string $flags * @return mixed */ - public function get($key, $flags = null) + public function get($key) { - return parent::get($this->key($key), $flags); + return parent::get($this->key($key)); } - public function decrement($key, $value = 1) + public function decrement($key, $offset = 1) { - return parent::decrement($this->key($key), $value); + return parent::decrement($this->key($key), $offset); } - public function increment($key, $value = 1) + public function increment($key, $offset = 1) { - return parent::increment($this->key($key), $value); + return parent::increment($this->key($key), $offset); } public function delete($key) @@ -141,9 +141,9 @@ public function delete($key) return parent::delete($this->key($key)); } - public function replace($key, $var, $flags = null, $expire = null) + public function replace($key, $var, $expire = 0) { - return parent::replace($this->key($key), $var, $flags, $expire); + return parent::replace($this->key($key), $var, $expire); } /** diff --git a/Core/Lock/File.php b/Core/Lock/File.php index 61ffb24..0d1c1f0 100755 --- a/Core/Lock/File.php +++ b/Core/Lock/File.php @@ -20,7 +20,7 @@ class Core_Lock_File extends Core_Lock_Lock implements Core_IPlugin protected $filename; - public function __construct(Core_Daemon $daemon, Array $args = array()) + public function __construct(Core_Daemon $daemon, array $args = array()) { parent::__construct($daemon, $args); if (isset($args['path'])) @@ -40,13 +40,13 @@ public function setup() public function teardown() { // If the lockfile was set by this process, remove it. If filename is empty, this is being called before setup() - if (!empty($this->filename) && $this->pid == @file_get_contents($this->filename)) + if (!empty($this->filename) && $this->pid == $this->get()) @unlink($this->filename); } - public function check_environment(Array $errors = array()) + public function check_environment(array $errors = array()) { - if (is_writable($this->path) == false) + if (!is_writable($this->path)) $errors[] = 'Lock File Path ' . $this->path . ' Not Writable.'; return $errors; @@ -54,11 +54,6 @@ public function check_environment(Array $errors = array()) public function set() { - $lock = $this->check(); - - if ($lock) - throw new Exception('Core_Lock_File::set Failed. Additional Lock Detected. PID: ' . $lock); - // The lock value will contain the process PID file_put_contents($this->filename, $this->pid); @@ -67,25 +62,11 @@ public function set() protected function get() { - if (file_exists($this->filename) == false) + if (!file_exists($this->filename)) return false; $lock = file_get_contents($this->filename); - // If we're seeing our own lock.. - if ($lock == $this->pid) - return false; - - // If the process that wrote the lock is no longer running - $cmd_output = `ps -p $lock`; - if (strpos($cmd_output, $lock) === false) - return false; - - // If the lock is expired - clearstatcache(); - if ((filemtime($this->filename) + $this->ttl + Core_Lock_Lock::$LOCK_TTL_PADDING_SECONDS) < time()) - return false; - return $lock; } } \ No newline at end of file diff --git a/Core/Lock/Lock.php b/Core/Lock/Lock.php index 2b6d649..10b8e8e 100755 --- a/Core/Lock/Lock.php +++ b/Core/Lock/Lock.php @@ -8,7 +8,6 @@ */ abstract class Core_Lock_Lock implements Core_IPlugin { - public static $LOCK_TTL_PADDING_SECONDS = 2.0; public static $LOCK_UNIQUE_ID = 'daemon_lock'; /** @@ -24,30 +23,20 @@ abstract class Core_Lock_Lock implements Core_IPlugin */ public $daemon_name; - /** - * This is added to the const LOCK_TTL_SECONDS to determine how long the lock should last -- any lock provider should be - * self-expiring using these TTL's. This is done to minimize likelihood of errant locks being left behind after a kill or crash that - * would have to be manually removed. - * - * @var float Number of seconds the lock should be active -- padded with Core_Lock_Lock::LOCK_TTL_PADDING_SECONDS - */ - public $ttl = 0; - /** * The array of args passed-in at instantiation * @var Array */ protected $args = array(); - public function __construct(Core_Daemon $daemon, Array $args = array()) + public function __construct(Core_Daemon $daemon, array $args = array()) { $this->pid = getmypid(); $this->daemon_name = get_class($daemon); - $this->ttl = $daemon->loop_interval(); $this->args = $args; - $daemon->on(Core_Daemon::ON_INIT, array($this, 'set')); - $daemon->on(Core_Daemon::ON_PREEXECUTE, array($this, 'set')); + $daemon->on(Core_Daemon::ON_INIT, array($this, 'check')); + $daemon->on(Core_Daemon::ON_PREEXECUTE, array($this, 'check')); $that = $this; $daemon->on(Core_Daemon::ON_PIDCHANGE, function ($args) use ($that) { @@ -76,18 +65,36 @@ abstract protected function get(); /** * Check for the existence of a lock. - * Cache results of get() check for 1/10 a second. * * @return bool|int Either false or the PID of the process that has set the lock */ - public function check() + protected function exists() { - static $get = false; - static $get_time = false; + $pid = $this->get(); - $get = $this->get(); - $get_time = microtime(true); + // pid should be a positive number + if (!$pid) + return false; + + // If we're seeing our own lock.. + if ($pid == $this->pid) + return false; - return $get; + // If the process that wrote the lock is no longer running + $cmd_output = `ps -p $pid`; + if (strpos($cmd_output, $pid) === false) + return false; + + return $pid; + } + + + public function check() + { + $lock = $this->exists(); + if ($lock) + throw new Exception(get_class($this) . '::' . __FUNCTION__ . ' failed. Existing lock detected from PID: ' . $lock); + + $this->set(); } } \ No newline at end of file diff --git a/Core/Lock/Memcached.php b/Core/Lock/Memcached.php index 81ace0e..c136fc8 100755 --- a/Core/Lock/Memcached.php +++ b/Core/Lock/Memcached.php @@ -40,8 +40,7 @@ public function setup() public function teardown() { // If this PID set this lock, release it - $lock = $this->memcache->get(Core_Lock_Lock::$LOCK_UNIQUE_ID); - if ($lock == $this->pid) + if ($this->get() == $this->pid) $this->memcache->delete(Core_Lock_Lock::$LOCK_UNIQUE_ID); } @@ -51,35 +50,25 @@ public function check_environment(Array $errors = array()) if (false == (is_array($this->memcache_servers) && count($this->memcache_servers))) $errors[] = 'Memcache Plugin: Memcache Servers Are Not Set'; - - if (false == class_exists('Core_Memcache')) - $errors[] = 'Memcache Plugin: Dependant Class "Core_Memcache" Is Not Loaded'; - - if (false == class_exists('Memcached')) - $errors[] = 'Memcache Plugin: PHP Memcached Extension Is Not Loaded'; + + if (false == class_exists('Memcached')) + $errors[] = 'Memcache Plugin: PHP Memcached Extension Is Not Loaded'; + + if (false == class_exists('Core_Lib_Memcache')) + $errors[] = 'Memcache Plugin: Dependant Class "Core_Lib_Memcache" Is Not Loaded'; return $errors; } public function set() { - $lock = $this->check(); - if ($lock) - throw new Exception('Core_Lock_Memcached::set Failed. Existing Lock Detected from PID ' . $lock); - - $timeout = Core_Lock_Lock::$LOCK_TTL_PADDING_SECONDS + $this->ttl; - $this->memcache->set(Core_Lock_Lock::$LOCK_UNIQUE_ID, $this->pid, false, $timeout); + $this->memcache->set(Core_Lock_Lock::$LOCK_UNIQUE_ID, $this->pid); } protected function get() { $lock = $this->memcache->get(Core_Lock_Lock::$LOCK_UNIQUE_ID); - - // Ensure we're not seeing our own lock - if ($lock == $this->pid) - return false; - // If We're here, there's another lock... return the pid.. return $lock; } } \ No newline at end of file diff --git a/Core/Lock/Shm.php b/Core/Lock/Shm.php index bdc8ed5..981c26d 100755 --- a/Core/Lock/Shm.php +++ b/Core/Lock/Shm.php @@ -27,8 +27,7 @@ public function setup() public function teardown() { // If this PID set this lock, release it - $lock = shm_get_var($this->shm, self::ADDRESS); - if ($lock == $this->pid) { + if ($this->get() == $this->pid) { shm_remove($this->shm); shm_detach($this->shm); } @@ -42,25 +41,16 @@ public function check_environment(Array $errors = array()) public function set() { - $lock = $this->check(); - if ($lock) - throw new Exception('Core_Lock_Shm::set Failed. Existing Lock Detected from PID ' . $lock); - - shm_put_var($this->shm, self::ADDRESS, array('pid' => $this->pid, 'time' => time())); + shm_put_var($this->shm, self::ADDRESS, $this->pid); } protected function get() { + if (!shm_has_var($this->shm)) + return false; + $lock = shm_get_var($this->shm, self::ADDRESS); - - // Ensure we're not seeing our own lock - if ($lock['pid'] == $this->pid) - return false; - - // If it's expired... - if ($lock['time'] + $this->ttl + Core_Lock_Lock::$LOCK_TTL_PADDING_SECONDS >= time()) - return $lock; - return false; + return $lock; } } \ No newline at end of file From 5b52e987958f973f16cd094261bd529262b7a4a5 Mon Sep 17 00:00:00 2001 From: soulhunter1987 Date: Sun, 4 May 2014 01:04:14 +0300 Subject: [PATCH 6/9] resolve conflict --- README.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/README.md b/README.md index e69e97f..9061db9 100644 --- a/README.md +++ b/README.md @@ -14,18 +14,11 @@ Create solid, long-running PHP daemon processes by extending the Core_Daemon cla * Namespace the code * Investigate updating the minimum version to PHP5.4. * More Details Here https://github.com/shaneharter/PHP-Daemon/wiki/Version-2.2 - -<<<<<<< HEAD -#### [NEW] Version 2.1 Beta Testing -* Version 2.1 is currently being developed in the branch `feature_abstract_ipc`. It's currently at alpha and a formal beta will be announced soon. -* Exciting features in 2.1 include: - * A new Socket Server plugin that lets you create event-driven async servers in a few lines of code. -======= + #### [NEW] Version 2.1 Released! * After a 9 month beta period, the code that was in the branch `feature_abstract_ipc` has been merged into master as v2.1 * Version 2.0 available in the v2.0 tag. * Exciting features in 2.1 include: ->>>>>>> 13c05c51beed2fd9609e030ef07d01f4f88db693 * A major refactoring of the Worker API includes pluggable IPC classes: Channel worker communication over any popular message queue or stick with the built-in SysV channel. * Improved, simpler worker debug shell with new, powerful commands and easier integration of custom breakpoints into your own worker code. * Centralize all the process forking, reaping and management code spread around the `Core_Daemon` and `Core_Worker_Mediator` classes into a simple ProcessManager plugin. From 23bb3757bdf36b6dd5aea4094f1379d1f14ce1a6 Mon Sep 17 00:00:00 2001 From: soulhunter1987 Date: Sun, 4 May 2014 01:16:38 +0300 Subject: [PATCH 7/9] Fixed initialization --- Core/Lock/Memcached.php | 11 +++-------- Core/Lock/Shm.php | 5 ----- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Core/Lock/Memcached.php b/Core/Lock/Memcached.php index c136fc8..0f32c0e 100755 --- a/Core/Lock/Memcached.php +++ b/Core/Lock/Memcached.php @@ -18,11 +18,6 @@ class Core_Lock_Memcached extends Core_Lock_Lock implements Core_IPlugin */ public $memcache_servers = array(); - public function __construct() - { - $this->pid = getmypid(); - } - public function setup() { // Connect to memcache @@ -48,13 +43,13 @@ public function check_environment(Array $errors = array()) { $errors = array(); - if (false == (is_array($this->memcache_servers) && count($this->memcache_servers))) + if (!(is_array($this->memcache_servers) && count($this->memcache_servers))) $errors[] = 'Memcache Plugin: Memcache Servers Are Not Set'; - if (false == class_exists('Memcached')) + if (!class_exists('Memcached')) $errors[] = 'Memcache Plugin: PHP Memcached Extension Is Not Loaded'; - if (false == class_exists('Core_Lib_Memcache')) + if (!class_exists('Core_Lib_Memcache')) $errors[] = 'Memcache Plugin: Dependant Class "Core_Lib_Memcache" Is Not Loaded'; return $errors; diff --git a/Core/Lock/Shm.php b/Core/Lock/Shm.php index 981c26d..d2ecb3b 100755 --- a/Core/Lock/Shm.php +++ b/Core/Lock/Shm.php @@ -12,11 +12,6 @@ class Core_Lock_Shm extends Core_Lock_Lock implements Core_IPlugin * @var Resource */ private $shm = false; - - public function __construct() - { - $this->pid = getmypid(); - } public function setup() { From 7e24a90bb79134ceb19beb3262f53170529bed59 Mon Sep 17 00:00:00 2001 From: soulhunter1987 Date: Sun, 4 May 2014 10:41:32 +0300 Subject: [PATCH 8/9] Method visibility and compatibility fixes --- Core/Lock/File.php | 5 +---- Core/Lock/Lock.php | 17 ++++++++++------- Core/Lock/Memcached.php | 2 +- Core/Lock/Shm.php | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Core/Lock/File.php b/Core/Lock/File.php index 0d1c1f0..4d53642 100755 --- a/Core/Lock/File.php +++ b/Core/Lock/File.php @@ -52,12 +52,9 @@ public function check_environment(array $errors = array()) return $errors; } - public function set() + protected function set() { - // The lock value will contain the process PID file_put_contents($this->filename, $this->pid); - - touch($this->filename); } protected function get() diff --git a/Core/Lock/Lock.php b/Core/Lock/Lock.php index 10b8e8e..d6ad4f5 100755 --- a/Core/Lock/Lock.php +++ b/Core/Lock/Lock.php @@ -35,8 +35,7 @@ public function __construct(Core_Daemon $daemon, array $args = array()) $this->daemon_name = get_class($daemon); $this->args = $args; - $daemon->on(Core_Daemon::ON_INIT, array($this, 'check')); - $daemon->on(Core_Daemon::ON_PREEXECUTE, array($this, 'check')); + $daemon->on(Core_Daemon::ON_INIT, array($this, 'run')); $that = $this; $daemon->on(Core_Daemon::ON_PIDCHANGE, function ($args) use ($that) { @@ -50,7 +49,7 @@ public function __construct(Core_Daemon $daemon, array $args = array()) * @abstract * @return void */ - abstract public function set(); + abstract protected function set(); /** * Read the lock from whatever shared medium it's written to. @@ -68,7 +67,7 @@ abstract protected function get(); * * @return bool|int Either false or the PID of the process that has set the lock */ - protected function exists() + protected function check() { $pid = $this->get(); @@ -88,10 +87,14 @@ protected function exists() return $pid; } - - public function check() + /** + * Implements main plugin logic - die if lock exists or create it otherwise. + * + * @return null + */ + public function run() { - $lock = $this->exists(); + $lock = $this->check(); if ($lock) throw new Exception(get_class($this) . '::' . __FUNCTION__ . ' failed. Existing lock detected from PID: ' . $lock); diff --git a/Core/Lock/Memcached.php b/Core/Lock/Memcached.php index 0f32c0e..d57dd65 100755 --- a/Core/Lock/Memcached.php +++ b/Core/Lock/Memcached.php @@ -55,7 +55,7 @@ public function check_environment(Array $errors = array()) return $errors; } - public function set() + protected function set() { $this->memcache->set(Core_Lock_Lock::$LOCK_UNIQUE_ID, $this->pid); } diff --git a/Core/Lock/Shm.php b/Core/Lock/Shm.php index d2ecb3b..30dcb93 100755 --- a/Core/Lock/Shm.php +++ b/Core/Lock/Shm.php @@ -34,14 +34,14 @@ public function check_environment(Array $errors = array()) return $errors; } - public function set() + protected function set() { shm_put_var($this->shm, self::ADDRESS, $this->pid); } protected function get() { - if (!shm_has_var($this->shm)) + if (!shm_has_var($this->shm, self::ADDRESS)) return false; $lock = shm_get_var($this->shm, self::ADDRESS); From b95cb21ea1aa9172660ff10d7c03125f17b0f564 Mon Sep 17 00:00:00 2001 From: soulhunter1987 Date: Sun, 4 May 2014 10:51:46 +0300 Subject: [PATCH 9/9] Change unique id to use standard value (pid) --- Core/Lock/Lock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Lock/Lock.php b/Core/Lock/Lock.php index d6ad4f5..7b6fef7 100755 --- a/Core/Lock/Lock.php +++ b/Core/Lock/Lock.php @@ -8,7 +8,7 @@ */ abstract class Core_Lock_Lock implements Core_IPlugin { - public static $LOCK_UNIQUE_ID = 'daemon_lock'; + public static $LOCK_UNIQUE_ID = 'pid'; /** * The pid of the current daemon -- Set automatically by the constructor.