Removed thread sleeping lock
Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
parent
93589c750e
commit
6a7d0b11a0
@ -51,7 +51,7 @@
|
||||
<dependency>
|
||||
<groupId>net.bigeon</groupId>
|
||||
<artifactId>smu</artifactId>
|
||||
<version>1.0.4</version>
|
||||
<version>1.0.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<parent>
|
||||
|
@ -118,7 +118,10 @@ public class ConsoleTestApplication {
|
||||
public void execute(final ConsoleOutput out, final ConsoleInput in,
|
||||
final String... args) throws CommandRunException {
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
Object obj = new Object();
|
||||
synchronized (obj) {
|
||||
obj.wait(2000);
|
||||
}
|
||||
output.println("Test command ran fine");
|
||||
} catch (IOException | InterruptedException e) {
|
||||
throw new CommandRunException("manager closed", e);
|
||||
|
@ -90,7 +90,10 @@ public class PluggableConsoleInputTest {
|
||||
|
||||
}
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
Object obj = new Object();
|
||||
synchronized (obj) {
|
||||
obj.wait(100);
|
||||
}
|
||||
} catch (final InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@ -112,7 +115,10 @@ public class PluggableConsoleInputTest {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
Object obj = new Object();
|
||||
synchronized (obj) {
|
||||
obj.wait(200);
|
||||
}
|
||||
} catch (final InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@ -162,8 +168,11 @@ public class PluggableConsoleInputTest {
|
||||
});
|
||||
th.start();
|
||||
|
||||
Object obj = new Object();
|
||||
synchronized (obj) {
|
||||
while (!input.isPrompting()) {
|
||||
Thread.sleep(10);
|
||||
obj.wait(10);
|
||||
}
|
||||
}
|
||||
|
||||
input.connect(pis, out);
|
||||
@ -184,8 +193,10 @@ public class PluggableConsoleInputTest {
|
||||
}
|
||||
});
|
||||
th2.start();
|
||||
synchronized (obj) {
|
||||
while (!input.isPrompting()) {
|
||||
Thread.sleep(10);
|
||||
obj.wait(10);
|
||||
}
|
||||
}
|
||||
|
||||
input.close();
|
||||
|
@ -76,7 +76,6 @@ public class SocketConsoleApplicationTest {
|
||||
public void testIntegration() throws IOException, InterruptedException {
|
||||
Thread server;
|
||||
server = TestServer.getServer();
|
||||
Thread.sleep(1000);
|
||||
final String hostName = "127.0.0.1";
|
||||
final int portNumber = 3300;
|
||||
|
||||
@ -128,11 +127,9 @@ public class SocketConsoleApplicationTest {
|
||||
}
|
||||
assertEquals("Application exit command should close connection", 4, i);
|
||||
}
|
||||
Thread.sleep(100);
|
||||
TestServer.closeServer();
|
||||
server.join();
|
||||
server = TestServer.getServer();
|
||||
Thread.sleep(1000);
|
||||
|
||||
try (Socket kkSocket = new Socket(hostName, portNumber);
|
||||
PrintWriter out = new PrintWriter(kkSocket.getOutputStream(), true);
|
||||
|
@ -90,6 +90,16 @@ public class TestServer {
|
||||
}
|
||||
});
|
||||
th.start();
|
||||
try {
|
||||
Object waiting = new Object();
|
||||
synchronized (waiting) {
|
||||
while (!input.isPrompting()) {
|
||||
waiting.wait(50);
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
return SHELL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user