33import com .rabbitmq .client .ConnectionFactory ;
44import com .rabbitmq .client .Connection ;
55import com .rabbitmq .client .Channel ;
6- import com .rabbitmq .client .GetResponse ;
76import com .rabbitmq .client .MessageProperties ;
87import com .rabbitmq .client .Consumer ;
98import com .rabbitmq .client .QueueingConsumer ;
@@ -37,18 +36,18 @@ public static void main(String[] args) throws Exception {
3736
3837 System .out .println ("buffer size, " +
3938 "publish rate with nagle, " +
40- "get rate with nagle, " +
39+ "consume rate with nagle, " +
4140 "publish rate without nagle, " +
42- "get rate without nagle" );
41+ "consume rate without nagle" );
4342
4443 for (int repeat = 0 ; repeat < REPEATS ; repeat ++) {
4544 final int bufferSize = 1 + rnd .nextInt (PEAK_SIZE );
4645
4746 double
4847 publishRateNagle = 0 ,
4948 publishRateNoNagle = 0 ,
50- getRateNagle = 0 ,
51- getRateNoNagle = 0 ;
49+ consumeRateNagle = 0 ,
50+ consumeRateNoNagle = 0 ;
5251
5352 for (final boolean useNagle : new boolean [] { false , true }) {
5453 ConnectionFactory factory = new ConnectionFactory () {
@@ -86,19 +85,19 @@ public void configureSocket(Socket socket)
8685 consumer .nextDelivery ();
8786 }
8887
89- long getTime = System .nanoTime () - start ;
88+ long consumeTime = System .nanoTime () - start ;
9089
9190 double publishRate =
9291 MESSAGE_COUNT / (publishTime / NANOSECONDS_PER_SECOND );
93- double getRate =
94- MESSAGE_COUNT / (getTime / NANOSECONDS_PER_SECOND );
92+ double consumeRate =
93+ MESSAGE_COUNT / (consumeTime / NANOSECONDS_PER_SECOND );
9594
9695 if (useNagle ){
9796 publishRateNagle = publishRate ;
98- getRateNagle = getRate ;
97+ consumeRateNagle = consumeRate ;
9998 } else {
10099 publishRateNoNagle = publishRate ;
101- getRateNoNagle = getRate ;
100+ consumeRateNoNagle = consumeRate ;
102101 }
103102
104103 connection .close ();
@@ -108,9 +107,9 @@ public void configureSocket(Socket socket)
108107
109108 System .out .println (bufferSize + ", " +
110109 publishRateNagle + ", " +
111- getRateNagle + ", " +
110+ consumeRateNagle + ", " +
112111 publishRateNoNagle + ", " +
113- getRateNoNagle );
112+ consumeRateNoNagle );
114113 }
115114 }
116115}
0 commit comments