Cancel timer if no longer needed.
This commit is contained in:
parent
7dffeb8665
commit
15e83c082e
1 changed files with 5 additions and 1 deletions
|
|
@ -34,6 +34,7 @@ import java.util.logging.Logger;
|
|||
import org.jgrapes.core.Channel;
|
||||
import org.jgrapes.core.Component;
|
||||
import org.jgrapes.core.Components;
|
||||
import org.jgrapes.core.Components.Timer;
|
||||
import org.jgrapes.core.annotation.Handler;
|
||||
import org.jgrapes.core.events.Start;
|
||||
import org.jgrapes.core.events.Stop;
|
||||
|
|
@ -74,6 +75,8 @@ public class QemuMonitor extends Component {
|
|||
private SocketIOChannel monitorChannel;
|
||||
private Stop suspendedStop;
|
||||
|
||||
private Timer powerdownTimer;
|
||||
|
||||
/**
|
||||
* Instantiates a new qemu monitor.
|
||||
*
|
||||
|
|
@ -223,6 +226,7 @@ public class QemuMonitor extends Component {
|
|||
monitorChannel = null;
|
||||
synchronized (this) {
|
||||
if (suspendedStop != null) {
|
||||
powerdownTimer.cancel();
|
||||
suspendedStop.resumeHandling();
|
||||
suspendedStop = null;
|
||||
}
|
||||
|
|
@ -244,7 +248,7 @@ public class QemuMonitor extends Component {
|
|||
writeToMonitor(monitorMessages.get("powerdown"));
|
||||
|
||||
// Schedule timer as fallback
|
||||
Components.schedule(t -> {
|
||||
powerdownTimer = Components.schedule(t -> {
|
||||
synchronized (this) {
|
||||
if (suspendedStop != null) {
|
||||
suspendedStop.resumeHandling();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue