Skip to content

Commit 0fd8911

Browse files
committed
minor simplification
1 parent 2df40be commit 0fd8911

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

test/src/com/rabbitmq/client/test/functional/QueueSizeLimit.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,26 +90,23 @@ public void testRequeueWithDlx() throws IOException, InterruptedException {
9090
private void setupNonDlxTest(int maxLen, boolean unAcked) throws IOException, InterruptedException {
9191
declareQueue(maxLen, false);
9292
fill(maxLen);
93-
if (unAcked)
94-
getUnacked(maxLen, null);
93+
if (unAcked) getUnacked(maxLen);
9594
publish("msg" + (maxLen + 1));
9695
}
9796

9897
private void setupDlxTest(int maxLen, boolean unAcked) throws IOException, InterruptedException {
9998
declareQueue(maxLen, true);
10099
fill(maxLen);
101-
if (unAcked)
102-
getUnacked(maxLen, null);
100+
if (unAcked) getUnacked(maxLen);
103101
publish("msg" + (maxLen + 1));
104102
try {
105103
Thread.sleep(100);
106104
} catch (InterruptedException _) { }
107105
}
108106

109107
private void setupRequeueTest(int maxLen) throws IOException, InterruptedException {
110-
List<Long> tags = new ArrayList<Long>(maxLen);
111108
fill(maxLen);
112-
getUnacked(maxLen, tags);
109+
List<Long> tags = getUnacked(maxLen);
113110
fill(maxLen);
114111
channel.basicNack(tags.get(0), false, true);
115112
if (maxLen > 1)
@@ -148,11 +145,12 @@ private void assertHead(int expectedLength, String expectedHeadPayload, String q
148145
}
149146
}
150147

151-
private void getUnacked(int howMany, List<Long> acks) throws IOException {
152-
for (;howMany > 0; howMany --){
148+
private List<Long> getUnacked(int howMany) throws IOException {
149+
List<Long> tags = new ArrayList<Long>(howMany);
150+
for (;howMany > 0; howMany --) {
153151
GetResponse response = channel.basicGet(q, false);
154-
if (acks != null)
155-
acks.add(response.getEnvelope().getDeliveryTag());
152+
tags.add(response.getEnvelope().getDeliveryTag());
156153
}
154+
return tags;
157155
}
158-
}
156+
}

0 commit comments

Comments
 (0)