Skip to content

Commit 17c4574

Browse files
author
Alexandru Scvortov
committed
better variable names (pubAck -> confirm)
1 parent 40c62a6 commit 17c4574

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

test/src/com/rabbitmq/examples/MulticastMain.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ public static void main(String[] args) {
8686
int consumerCount = intArg(cmd, 'y', 1);
8787
int producerTxSize = intArg(cmd, 'm', 0);
8888
int consumerTxSize = intArg(cmd, 'n', 0);
89-
boolean pubAck = cmd.hasOption('c');
90-
long pubAckCount = intArg(cmd, 'k', 0);
89+
boolean confirm = cmd.hasOption('c');
90+
long confirmMax = intArg(cmd, 'k', 0);
9191
boolean autoAck = cmd.hasOption('a');
9292
int prefetchCount = intArg(cmd, 'q', 0);
9393
int minMsgSize = intArg(cmd, 's', 0);
@@ -96,9 +96,9 @@ public static void main(String[] args) {
9696
int frameMax = intArg(cmd, 'M', 0);
9797
int heartbeat = intArg(cmd, 'b', 0);
9898

99-
if ((producerTxSize + consumerTxSize > 0) && pubAck) {
99+
if ((producerTxSize + consumerTxSize > 0) && confirm) {
100100
throw new ParseException("Cannot select both producerTxSize"+
101-
"/consumerTxSize and pubAck.");
101+
"/consumerTxSize and confirm");
102102
}
103103

104104
//setup
@@ -141,13 +141,13 @@ public static void main(String[] args) {
141141
producerConnections[i] = conn;
142142
Channel channel = conn.createChannel();
143143
if (producerTxSize > 0) channel.txSelect();
144-
if (pubAck) channel.confirmSelect();
144+
if (confirm) channel.confirmSelect();
145145
channel.exchangeDeclare(exchangeName, exchangeType);
146146
final Producer p = new Producer(channel, exchangeName, id,
147147
flags, producerTxSize,
148148
1000L * samplingInterval,
149149
rateLimit, minMsgSize, timeLimit,
150-
pubAckCount);
150+
confirmMax);
151151
channel.setReturnListener(p);
152152
channel.setAckListener(p);
153153
Thread t = new Thread(p);
@@ -193,9 +193,9 @@ private static Options getOptions() {
193193
options.addOption(new Option("x", "producers", true, "producer count"));
194194
options.addOption(new Option("y", "consumers", true, "consumer count"));
195195
options.addOption(new Option("m", "ptxsize", true, "producer tx size"));
196-
options.addOption(new Option("k", "pubackcnt", true, "max unack'd publishes"));
196+
options.addOption(new Option("k", "confirmMax", true, "max unconfirmed publishes"));
197197
options.addOption(new Option("n", "ctxsize", true, "consumer tx size"));
198-
options.addOption(new Option("c", "puback", false,"publisher acks"));
198+
options.addOption(new Option("c", "confirm", false,"confirm mode"));
199199
options.addOption(new Option("a", "autoack", false,"auto ack"));
200200
options.addOption(new Option("q", "qos", true, "qos prefetch count"));
201201
options.addOption(new Option("s", "size", true, "message size"));
@@ -244,13 +244,13 @@ public static class Producer implements Runnable, ReturnListener, AckListener {
244244
private int msgCount;
245245
private int basicReturnCount;
246246

247-
private long pubAckCount;
247+
private long confirmMax;
248248
private long mostRecentAcked;
249249

250250
public Producer(Channel channel, String exchangeName, String id,
251251
List flags, int txSize,
252252
long interval, int rateLimit, int minMsgSize, int timeLimit,
253-
long pubAckCount)
253+
long confirmMax)
254254
throws IOException {
255255

256256
this.channel = channel;
@@ -263,7 +263,7 @@ public Producer(Channel channel, String exchangeName, String id,
263263
this.interval = interval;
264264
this.rateLimit = rateLimit;
265265
this.timeLimit = 1000L * timeLimit;
266-
this.pubAckCount = pubAckCount;
266+
this.confirmMax = confirmMax;
267267
this.message = new byte[minMsgSize];
268268
}
269269

@@ -302,7 +302,7 @@ public void run() {
302302
try {
303303

304304
while (timeLimit == 0 || now < startTime + timeLimit) {
305-
if (!throttlePubAck()) {
305+
if (!throttleConfirms()) {
306306
delay(now);
307307
publish(createMessage(totalMsgCount));
308308
totalMsgCount++;
@@ -338,8 +338,8 @@ private void publish(byte[] msg)
338338
msg);
339339
}
340340

341-
private boolean throttlePubAck() {
342-
return ((pubAckCount > 0) && (channel.getNextPublishSeqNo() - mostRecentAcked > pubAckCount));
341+
private boolean throttleConfirms() {
342+
return ((confirmMax > 0) && (channel.getNextPublishSeqNo() - mostRecentAcked > confirmMax));
343343
}
344344

345345
private void delay(long now)

0 commit comments

Comments
 (0)