File tree Expand file tree Collapse file tree
main/java/io/appium/java_client/service/local
test/java/io/appium/java_client/localserver Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public final class AppiumDriverLocalService extends DriverService {
4444 private final String ipAddress ;
4545 private final long startupTimeout ;
4646 private final TimeUnit timeUnit ;
47- private final ReentrantLock lock = new ReentrantLock ();
47+ private final ReentrantLock lock = new ReentrantLock (true );
4848 private final ListOutputStream stream = new ListOutputStream ().add (System .out );
4949
5050
Original file line number Diff line number Diff line change @@ -204,8 +204,10 @@ public void whenFewTreadsDoDifferentWork() throws Throwable {
204204 assertTrue (stopTestThread .result .equals ("OK" )); //and then the test tried to shut down it (see (3))
205205 assertTrue (!service .isRunning ());
206206
207- stopThread2 .start (); // (1)
208- isRunningThread2 .start (); // (2)
207+ isRunningThread2 .start (); // (1)
208+ Thread .sleep (10 );
209+ stopThread2 .start (); // (2)
210+ Thread .sleep (10 );
209211 runThread2 .start (); //(3)
210212
211213 while (runThread2 .isAlive () || isRunningThread2 .isAlive () || stopThread2 .isAlive ()) {
@@ -224,8 +226,8 @@ public void whenFewTreadsDoDifferentWork() throws Throwable {
224226 throw stopTestThread .t ;
225227 }
226228
227- assertTrue (stopTestThread2 .result .equals ("OK" )); //the service had not been started firstly (see (1)), it is ok
228- assertTrue (isRunningTestThread2 .result .equals (false )); //so it couldn't being running (see (2))
229+ assertTrue (isRunningTestThread2 .result .equals (false )); //the service wasn't being running (see (1))
230+ assertTrue (stopTestThread2 .result .equals ("OK" )); //the service had not been started firstly (see (2)), it is ok
229231 assertTrue (runTestThread2 .result .equals ("OK" )); //and then it was started (see (3))
230232 assertTrue (service .isRunning ());
231233 }
You can’t perform that action at this time.
0 commit comments