3 namespace Org\Mxchange\CoreFramework\Task\IdleLoop;
5 // Import Framework stuff
6 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
7 use Org\Mxchange\CoreFramework\Task\BaseTask;
8 use Org\Mxchange\CoreFramework\Task\Taskable;
9 use Org\Mxchange\CoreFramework\Visitor\Visitable;
10 use Org\Mxchange\CoreFramework\Visitor\Visitor;
15 * @author Roland Haeder <webmaster@shipsimu.org>
17 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
18 * @license GNU GPL 3.0 or any newer version
19 * @link http://www.shipsimu.org
21 * This program is free software: you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation, either version 3 of the License, or
24 * (at your option) any later version.
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License
32 * along with this program. If not, see <http://www.gnu.org/licenses/>.
34 class IdleLoopTask extends BaseTask implements Taskable, Visitable {
38 private $idleTime = 0;
41 * Protected constructor
45 protected function __construct () {
46 // Call parent constructor
47 parent::__construct(__CLASS__);
49 // Init idle loop time from config ("cache" it here)
50 $this->idleTime = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('idle_loop_time');
54 * Creates an instance of this class
56 * @return $taskInstance An instance of a Taskable/Visitable class
58 public static final function createIdleLoopTask () {
60 $taskInstance = new IdleLoopTask();
62 // Return the prepared instance
67 * Accepts the visitor to process the visitor
69 * @param $visitorInstance An instance of a Visitor class
72 public function accept (Visitor $visitorInstance) {
74 $visitorInstance->visitTask($this);
82 public function executeTask () {
84 $this->idle($this->idleTime);
88 * Shutdown this task, this does nothing here, just supply the method.
92 public function doShutdown () {
94 self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...');