Fix warnings.
This commit is contained in:
parent
23703bad3c
commit
3708244571
3 changed files with 10 additions and 7 deletions
|
|
@ -238,6 +238,8 @@ public class QemuMonitor extends Component {
|
|||
* @param event the event
|
||||
*/
|
||||
@Handler
|
||||
@SuppressWarnings({ "PMD.AvoidSynchronizedStatement",
|
||||
"PMD.AvoidDuplicateLiterals" })
|
||||
public void onClosed(Closed<?> event, SocketIOChannel channel) {
|
||||
channel.associated(QemuMonitor.class).ifPresent(qm -> {
|
||||
monitorChannel = null;
|
||||
|
|
@ -259,7 +261,8 @@ public class QemuMonitor extends Component {
|
|||
* @param event the event
|
||||
*/
|
||||
@Handler
|
||||
@SuppressWarnings("PMD.AvoidLiteralsInIfCondition")
|
||||
@SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition",
|
||||
"PMD.AvoidSynchronizedStatement" })
|
||||
public void onExecQmpCommand(MonitorCommand event) {
|
||||
var command = event.command();
|
||||
logger.fine(() -> "monitor(out): " + command.toString());
|
||||
|
|
@ -290,6 +293,7 @@ public class QemuMonitor extends Component {
|
|||
* @param event the event
|
||||
*/
|
||||
@Handler(priority = 100)
|
||||
@SuppressWarnings("PMD.AvoidSynchronizedStatement")
|
||||
public void onStop(Stop event) {
|
||||
if (monitorChannel != null) {
|
||||
// We have a connection to Qemu, attempt ACPI shutdown.
|
||||
|
|
@ -321,6 +325,7 @@ public class QemuMonitor extends Component {
|
|||
* @param event the event
|
||||
*/
|
||||
@Handler
|
||||
@SuppressWarnings("PMD.AvoidSynchronizedStatement")
|
||||
public void onPowerdownEvent(PowerdownEvent event) {
|
||||
synchronized (this) {
|
||||
// Cancel confirmation timeout
|
||||
|
|
@ -349,6 +354,7 @@ public class QemuMonitor extends Component {
|
|||
* @param event the event
|
||||
*/
|
||||
@Handler
|
||||
@SuppressWarnings("PMD.AvoidSynchronizedStatement")
|
||||
public void onConfigureQemu(ConfigureQemu event) {
|
||||
int newTimeout = event.configuration().vm.powerdownTimeout;
|
||||
if (powerdownTimeout != newTimeout) {
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ import java.nio.file.Path;
|
|||
import java.nio.file.Paths;
|
||||
import java.time.Instant;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
|
@ -227,7 +227,7 @@ public class Runner extends Component {
|
|||
CloudInit
|
||||
}
|
||||
|
||||
private final Set<QemuPreps> qemuLatch = new HashSet<>();
|
||||
private final Set<QemuPreps> qemuLatch = EnumSet.noneOf(QemuPreps.class);
|
||||
|
||||
/**
|
||||
* Instantiates a new runner.
|
||||
|
|
@ -483,6 +483,7 @@ public class Runner extends Component {
|
|||
mayBeStartQemu(QemuPreps.Config);
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.AvoidSynchronizedStatement")
|
||||
private void mayBeStartQemu(QemuPreps done) {
|
||||
synchronized (qemuLatch) {
|
||||
if (qemuLatch.isEmpty()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue