* Some minor changes to sleep command (fixes #2992).

This commit is contained in:
LevelX2 2017-04-02 11:32:25 +02:00
parent 4c35650b2b
commit 5a072ea760
12 changed files with 133 additions and 140 deletions

View file

@ -1,7 +1,8 @@
package mage.client.util.audio;
import java.io.File;
import java.awt.List;
import java.io.File;
import java.util.concurrent.TimeUnit;
import javax.sound.sampled.*;
import mage.client.constants.Constants;
import mage.client.dialog.PreferencesDialog;
@ -75,7 +76,7 @@ public class MusicPlayer {
player.breaked_out = true;
player.breaked = true;
try {
Thread.sleep(100);
TimeUnit.MILLISECONDS.sleep(100);
} catch (Exception e) {
log.error("Thread error: " + e);
}
@ -119,7 +120,7 @@ public class MusicPlayer {
public void run() {
try {
Thread.sleep(100);
TimeUnit.MILLISECONDS.sleep(100);
} catch (Exception e) {
}
while (!stopped) {
@ -130,7 +131,7 @@ public class MusicPlayer {
PlayThread.start();
while (!(breaked || breaked_out)) {
try {
Thread.sleep(10);
TimeUnit.MILLISECONDS.sleep(10);
} catch (Exception e) {
log.error("Thread error: " + e);
}

View file

@ -3,6 +3,7 @@ package mage.client.util.gui;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.util.concurrent.TimeUnit;
/**
* Utility class for creating BufferedImage object from Image instance.
@ -65,7 +66,7 @@ public class BufferedImageBuilder {
});
while (!imageLoadStatus.widthDone && !imageLoadStatus.heightDone) {
try {
Thread.sleep(300);
TimeUnit.MILLISECONDS.sleep(300);
} catch (InterruptedException e) {
}
@ -73,8 +74,9 @@ public class BufferedImageBuilder {
}
static class ImageLoadStatus {
public boolean widthDone = false;
public boolean heightDone = false;
}
}
}