Skip to content

Commit 2043674

Browse files
committed
Removed forks
1 parent 6142a22 commit 2043674

File tree

2 files changed

+15
-26
lines changed

2 files changed

+15
-26
lines changed

CodenameOne/src/com/codename1/io/NetworkManager.java

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -430,38 +430,31 @@ public void actionPerformed(NetworkEvent e) {
430430
public void addToQueueAndWait(final ConnectionRequest request) {
431431
class WaitingClass implements Runnable, ActionListener<NetworkEvent> {
432432
private final boolean edt = CN.isEdt();
433-
434-
private boolean isInQueueOrProcessing() {
435-
synchronized (LOCK) {
436-
if(pending == null || networkThreads == null) {
437-
return false;
438-
}
439-
if(pending.contains(request)) {
440-
return true;
441-
}
442-
for(NetworkThread t : networkThreads) {
443-
if(t.currentRequest == request) {
444-
return true;
445-
}
446-
}
447-
}
448-
return false;
449-
}
433+
private boolean finishedWaiting;
450434

451435
public void run() {
452436
if (edt) {
453-
while (isInQueueOrProcessing()) {
454-
Util.sleep(30);
437+
while (!finishedWaiting) {
438+
try {
439+
Thread.sleep(30);
440+
} catch (InterruptedException ex) {
441+
ex.printStackTrace();
442+
}
455443
}
456444
} else {
457-
while (isInQueueOrProcessing()) {
458-
Util.sleep(30);
445+
while (!request.complete) {
446+
try {
447+
Thread.sleep(30);
448+
} catch (InterruptedException ex) {
449+
ex.printStackTrace();
450+
}
459451
}
460452
}
461453
}
462454

463455
public void actionPerformed(NetworkEvent e) {
464456
if (e.getError() != null) {
457+
finishedWaiting = true;
465458
removeProgressListener(this);
466459
removeErrorListener(this);
467460
return;
@@ -472,6 +465,7 @@ public void actionPerformed(NetworkEvent e) {
472465
request.retrying = false;
473466
return;
474467
}
468+
finishedWaiting = true;
475469
removeProgressListener(this);
476470
removeErrorListener(this);
477471
}

maven/core-unittests/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
<groupId>org.apache.maven.plugins</groupId>
3434
<artifactId>maven-surefire-plugin</artifactId>
3535
<version>3.2.1</version>
36-
<configuration>
37-
<!-- Run each test in its own forked JVM to ensure an isolated classloader. -->
38-
<forkCount>1C</forkCount>
39-
<reuseForks>true</reuseForks>
40-
</configuration>
4136
</plugin>
4237
<plugin>
4338
<groupId>org.jacoco</groupId>

0 commit comments

Comments
 (0)