53
53
* printed to stdout.
54
54
*/
55
55
public class Tracer implements Runnable {
56
- private static boolean property (String property ){
56
+ private static boolean property (String property ) {
57
57
return Boolean .parseBoolean (System .getProperty (
58
58
"com.rabbitmq.tools.Tracer." + property ));
59
59
}
@@ -76,16 +76,16 @@ private static boolean property(String property){
76
76
final static int MAX_TIME_BETWEEN_FLUSHES = 1000 ;
77
77
final static Object FLUSH = new Object ();
78
78
79
- private static class AsyncLogger extends Thread {
79
+ private static class AsyncLogger extends Thread {
80
80
final PrintStream ps ;
81
81
final BlockingQueue <Object > queue = new ArrayBlockingQueue <Object >(LOG_QUEUE_SIZE , true );
82
- AsyncLogger (PrintStream ps ){
82
+ AsyncLogger (PrintStream ps ) {
83
83
this .ps = new PrintStream (new BufferedOutputStream (ps , BUFFER_SIZE ), false );
84
84
start ();
85
85
86
- new Thread (){
87
- @ Override public void run (){
88
- while (true ){
86
+ new Thread () {
87
+ @ Override public void run () {
88
+ while (true ) {
89
89
try {
90
90
Thread .sleep (MAX_TIME_BETWEEN_FLUSHES );
91
91
queue .add (FLUSH );
@@ -96,25 +96,25 @@ private static class AsyncLogger extends Thread{
96
96
}.start ();
97
97
}
98
98
99
- void printMessage (String message ){
99
+ void printMessage (String message ) {
100
100
ps .println (message );
101
101
}
102
102
103
- @ Override public void run (){
103
+ @ Override public void run () {
104
104
try {
105
- while (true ){
105
+ while (true ) {
106
106
Object message = queue .take ();
107
107
if (message == FLUSH ) ps .flush ();
108
108
else printMessage ((String )message );
109
109
}
110
- } catch (InterruptedException interrupt ){
110
+ } catch (InterruptedException interrupt ) {
111
111
}
112
112
}
113
113
114
- void log (String message ){
114
+ void log (String message ) {
115
115
try {
116
116
queue .put (message );
117
- } catch (InterruptedException ex ){
117
+ } catch (InterruptedException ex ) {
118
118
throw new RuntimeException (ex );
119
119
}
120
120
}
@@ -211,12 +211,12 @@ public void run() {
211
211
}
212
212
}
213
213
214
- public void log (String message ){
214
+ public void log (String message ) {
215
215
logger .log ("" + System .currentTimeMillis () + ": conn#"
216
216
+ id + " " + message );
217
217
}
218
218
219
- public void logException (Exception e ){
219
+ public void logException (Exception e ) {
220
220
log ("uncaught " + Utility .makeStackTrace (e ));
221
221
}
222
222
@@ -277,7 +277,7 @@ public void doFrame() throws IOException {
277
277
278
278
if (f != null ) {
279
279
280
- if (SILENT_MODE ){
280
+ if (SILENT_MODE ) {
281
281
f .writeTo (o );
282
282
return ;
283
283
}
@@ -300,7 +300,7 @@ public void doFrame() throws IOException {
300
300
}
301
301
} else {
302
302
AMQCommand .Assembler c = assemblers .get (f .channel );
303
- if (c == null ){
303
+ if (c == null ) {
304
304
c = AMQCommand .newAssembler ();
305
305
assemblers .put (f .channel , c );
306
306
}
0 commit comments