ARTEMIS-2320 'while' statement does not loop

This commit is contained in:
Jiri Danek 2019-04-25 16:14:27 +02:00 committed by Michael Andre Pearce
parent b33874488b
commit 781e4c460d
2 changed files with 13 additions and 19 deletions

View File

@ -3748,16 +3748,12 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
} }
} }
while (true) { if (messagesIterator != null && messagesIterator.hasNext()) {
if (messagesIterator != null && messagesIterator.hasNext()) { MessageReference msg = messagesIterator.next();
MessageReference msg = messagesIterator.next(); if (msg.isPaged()) {
if (msg.isPaged()) { previouslyBrowsed.add(((PagedReference) msg).getPosition());
previouslyBrowsed.add(((PagedReference) msg).getPosition());
}
return msg;
} else {
break;
} }
return msg;
} }
if (getPagingIterator() != null) { if (getPagingIterator() != null) {
while (getPagingIterator().hasNext()) { while (getPagingIterator().hasNext()) {

View File

@ -48,16 +48,14 @@ public class SpawnedJMSServer {
System.out.println("OK"); System.out.println("OK");
String line = null; String line = br.readLine();
while ((line = br.readLine()) != null) { if (line != null && "STOP".equals(line.trim())) {
if ("STOP".equals(line.trim())) { stopServer();
stopServer(); System.out.println("Server stopped");
System.out.println("Server stopped"); System.exit(0);
System.exit(0); } else {
} else { // stop anyway but with an error status
// stop anyway but with an error status System.exit(1);
System.exit(1);
}
} }
} catch (Throwable t) { } catch (Throwable t) {
t.printStackTrace(); t.printStackTrace();