3
3
import com .rabbitmq .client .ConnectionFactory ;
4
4
import com .rabbitmq .client .Connection ;
5
5
import com .rabbitmq .client .Channel ;
6
- import com .rabbitmq .client .GetResponse ;
7
6
import com .rabbitmq .client .MessageProperties ;
8
7
import com .rabbitmq .client .Consumer ;
9
8
import com .rabbitmq .client .QueueingConsumer ;
@@ -37,18 +36,18 @@ public static void main(String[] args) throws Exception {
37
36
38
37
System .out .println ("buffer size, " +
39
38
"publish rate with nagle, " +
40
- "get rate with nagle, " +
39
+ "consume rate with nagle, " +
41
40
"publish rate without nagle, " +
42
- "get rate without nagle" );
41
+ "consume rate without nagle" );
43
42
44
43
for (int repeat = 0 ; repeat < REPEATS ; repeat ++) {
45
44
final int bufferSize = 1 + rnd .nextInt (PEAK_SIZE );
46
45
47
46
double
48
47
publishRateNagle = 0 ,
49
48
publishRateNoNagle = 0 ,
50
- getRateNagle = 0 ,
51
- getRateNoNagle = 0 ;
49
+ consumeRateNagle = 0 ,
50
+ consumeRateNoNagle = 0 ;
52
51
53
52
for (final boolean useNagle : new boolean [] { false , true }) {
54
53
ConnectionFactory factory = new ConnectionFactory () {
@@ -86,19 +85,19 @@ public void configureSocket(Socket socket)
86
85
consumer .nextDelivery ();
87
86
}
88
87
89
- long getTime = System .nanoTime () - start ;
88
+ long consumeTime = System .nanoTime () - start ;
90
89
91
90
double publishRate =
92
91
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 );
95
94
96
95
if (useNagle ){
97
96
publishRateNagle = publishRate ;
98
- getRateNagle = getRate ;
97
+ consumeRateNagle = consumeRate ;
99
98
} else {
100
99
publishRateNoNagle = publishRate ;
101
- getRateNoNagle = getRate ;
100
+ consumeRateNoNagle = consumeRate ;
102
101
}
103
102
104
103
connection .close ();
@@ -108,9 +107,9 @@ public void configureSocket(Socket socket)
108
107
109
108
System .out .println (bufferSize + ", " +
110
109
publishRateNagle + ", " +
111
- getRateNagle + ", " +
110
+ consumeRateNagle + ", " +
112
111
publishRateNoNagle + ", " +
113
- getRateNoNagle );
112
+ consumeRateNoNagle );
114
113
}
115
114
}
116
115
}
0 commit comments