3 namespace Org\Mxchange\CoreFramework\Task\IdleLoop;
5 // Import Framework stuff
6 use Org\Mxchange\CoreFramework\Task\BaseTask;
7 use Org\Mxchange\CoreFramework\Task\Taskable;
8 use Org\Mxchange\CoreFramework\Visitor\Visitable;
9 use Org\Mxchange\CoreFramework\Visitor\Visitor;
14 * @author Roland Haeder <webmaster@shipsimu.org>
16 <<<<<<< HEAD:framework/main/classes/tasks/idle/class_IdleLoopTask.php
17 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
19 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2016 Core Developer Team
20 >>>>>>> Some updates::inc/main/classes/tasks/idle/class_IdleLoopTask.php
21 * @license GNU GPL 3.0 or any newer version
22 * @link http://www.shipsimu.org
24 * This program is free software: you can redistribute it and/or modify
25 * it under the terms of the GNU General Public License as published by
26 * the Free Software Foundation, either version 3 of the License, or
27 * (at your option) any later version.
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
34 * You should have received a copy of the GNU General Public License
35 * along with this program. If not, see <http://www.gnu.org/licenses/>.
37 class IdleLoopTask extends BaseTask implements Taskable, Visitable {
41 private $idleTime = 0;
44 * Protected constructor
48 protected function __construct () {
49 // Call parent constructor
50 parent::__construct(__CLASS__);
52 // Init idle loop time from config ("cache" it here)
53 $this->idleTime = $this->getConfigInstance()->getConfigEntry('idle_loop_time');
57 * Creates an instance of this class
59 * @return $taskInstance An instance of a Taskable/Visitable class
61 public static final function createIdleLoopTask () {
63 $taskInstance = new IdleLoopTask();
65 // Return the prepared instance
70 * Accepts the visitor to process the visitor
72 * @param $visitorInstance An instance of a Visitor class
75 public function accept (Visitor $visitorInstance) {
77 $visitorInstance->visitTask($this);
85 public function executeTask () {
87 $this->idle($this->idleTime);
91 * Shutdown this task, this does nothing here, just supply the method.
95 public function doShutdown () {
97 self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...');