@@ -100,16 +100,15 @@ public static void main(String[] args) {
100100 Connection [] consumerConnections = new Connection [consumerCount ];
101101 for (int i = 0 ; i < consumerCount ; i ++) {
102102 System .out .println ("starting consumer #" + i );
103- Connection conn = new ConnectionFactory (params ){
104- @ Override public void configureSocket (Socket socket ) throws IOException {
105- super .configureSocket (socket );
106- if (recvBufferSize > 0 )
107- socket .setReceiveBufferSize (recvBufferSize );
108- if (sendBufferSize > 0 )
109- socket .setSendBufferSize (sendBufferSize );
110-
111- }
112- }.newConnection (addresses , maxRedirects );
103+ Connection conn = new ConnectionFactory (params ) {
104+ public void configureSocket (Socket socket ) throws IOException {
105+ super .configureSocket (socket );
106+ if (recvBufferSize > 0 )
107+ socket .setReceiveBufferSize (recvBufferSize );
108+ if (sendBufferSize > 0 )
109+ socket .setSendBufferSize (sendBufferSize );
110+ }
111+ }.newConnection (addresses , maxRedirects );
113112 consumerConnections [i ] = conn ;
114113 Channel channel = conn .createChannel ();
115114 if (consumerTxSize > 0 ) channel .txSelect ();
@@ -120,7 +119,7 @@ public static void main(String[] args) {
120119 if (prefetchCount > 0 ) channel .basicQos (prefetchCount );
121120 channel .basicConsume (queueName , autoAck , consumer );
122121 channel .queueBind (queueName , exchangeName , id );
123- Thread t =
122+ Thread t =
124123 new Thread (new Consumer (consumer , id ,
125124 consumerTxSize , autoAck ,
126125 stats , timeLimit ));
@@ -136,7 +135,7 @@ public static void main(String[] args) {
136135 Channel channel = conn .createChannel ();
137136 if (producerTxSize > 0 ) channel .txSelect ();
138137 channel .exchangeDeclare (exchangeName , exchangeType );
139- Thread t =
138+ Thread t =
140139 new Thread (new Producer (channel , exchangeName , id ,
141140 flags , producerTxSize ,
142141 1000L * samplingInterval ,
@@ -169,24 +168,24 @@ public static void main(String[] args) {
169168
170169 private static Options getOptions () {
171170 Options options = new Options ();
172- options .addOption (new Option ("h" , "host" , true , "broker host" ));
173- options .addOption (new Option ("p" , "port" , true , "broker port" ));
174- options .addOption (new Option ("t" , "type" , true , "exchange type" ));
175- options .addOption (new Option ("e" , "exchange" , true , "exchange name" ));
176- options .addOption (new Option ("i" , "interval" , true , "sampling interval" ));
177- options .addOption (new Option ("r" , "rate" , true , "rate limit" ));
178- options .addOption (new Option ("x" , "producers" , true , "producer count" ));
179- options .addOption (new Option ("y" , "consumers" , true , "consumer count" ));
180- options .addOption (new Option ("m" , "ptxsize" , true , "producer tx size" ));
181- options .addOption (new Option ("n" , "ctxsize" , true , "consumer tx size" ));
182- options .addOption (new Option ("a" , "autoack" , false ,"auto ack" ));
183- options .addOption (new Option ("q" , "qos" , true , "qos prefetch count" ));
184- options .addOption (new Option ("s" , "size" , true , "message size" ));
185- options .addOption (new Option ("d" , "redirects" , true , "max redirects" ));
186- options .addOption (new Option ("z" , "time" , true , "time limit" ));
187- options .addOption (new Option ("b" , "sendbuffer" ,true , "send buffer size" ));
188- options .addOption (new Option ("c" , "recvbuffer" ,true , "receive buffer size" ));
189- Option flag = new Option ("f" , "flag" , true , "message flag" );
171+ options .addOption (new Option ("h" , "host" , true , "broker host" ));
172+ options .addOption (new Option ("p" , "port" , true , "broker port" ));
173+ options .addOption (new Option ("t" , "type" , true , "exchange type" ));
174+ options .addOption (new Option ("e" , "exchange" , true , "exchange name" ));
175+ options .addOption (new Option ("i" , "interval" , true , "sampling interval" ));
176+ options .addOption (new Option ("r" , "rate" , true , "rate limit" ));
177+ options .addOption (new Option ("x" , "producers" , true , "producer count" ));
178+ options .addOption (new Option ("y" , "consumers" , true , "consumer count" ));
179+ options .addOption (new Option ("m" , "ptxsize" , true , "producer tx size" ));
180+ options .addOption (new Option ("n" , "ctxsize" , true , "consumer tx size" ));
181+ options .addOption (new Option ("a" , "autoack" , false ,"auto ack" ));
182+ options .addOption (new Option ("q" , "qos" , true , "qos prefetch count" ));
183+ options .addOption (new Option ("s" , "size" , true , "message size" ));
184+ options .addOption (new Option ("d" , "redirects" , true , "max redirects" ));
185+ options .addOption (new Option ("z" , "time" , true , "time limit" ));
186+ options .addOption (new Option ("b" , "sendbuffer" , true , "send buffer size" ));
187+ options .addOption (new Option ("c" , "recvbuffer" , true , "receive buffer size" ));
188+ Option flag = new Option ("f" , "flag" , true , "message flag" );
190189 flag .setArgs (Option .UNLIMITED_VALUES );
191190 options .addOption (flag );
192191 return options ;
0 commit comments