ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
PersistingObserver.php
Go to the documentation of this file.
1<?php
2
4
9
18{
19 protected $bucket;
20 protected $persistence;
21
22
24 {
25 $this->bucket = $bucket;
26 $this->persistence = $persistence;
27 }
28
29
34 public function notifyState($state)
35 {
36 $this->bucket->setState($state);
37 $this->bucket->heartbeat();
38 $this->persistence->updateBucket($this->bucket);
39 }
40
41
47 public function notifyPercentage(Task $task, $percentage)
48 {
49 $this->bucket->setPercentage($task, $percentage);
50 $this->bucket->heartbeat();
51 $this->persistence->updateBucket($this->bucket);
52 }
53
54
58 public function notifyCurrentTask(Task $task)
59 {
60 $this->bucket->setCurrentTask($task);
61 $this->bucket->heartbeat();
62 $this->persistence->updateBucket($this->bucket);
63 }
64
65
72 public function heartbeat()
73 {
74 $this->bucket->heartbeat();
75 $this->persistence->updateBucket($this->bucket);
76 }
77}
An exception for terminatinating execution or to throw for unit testing.
heartbeat()
I'm still alive! If your calculation takes a really long time don't forget to use the heartbeat.