@@ -262,7 +262,9 @@ private void onopen() {
262
262
}
263
263
264
264
private void onclose (String reason ) {
265
- logger .fine (String .format ("close (%s)" , reason ));
265
+ if (logger .isLoggable (Level .FINE )) {
266
+ logger .fine (String .format ("close (%s)" , reason ));
267
+ }
266
268
this .connected = false ;
267
269
this .id = null ;
268
270
this .emit (EVENT_DISCONNECT , reason );
@@ -316,7 +318,9 @@ private void onpacket(Packet<?> packet) {
316
318
317
319
private void onevent (Packet <JSONArray > packet ) {
318
320
List <Object > args = new ArrayList <Object >(Arrays .asList (toArray (packet .data )));
319
- logger .fine (String .format ("emitting event %s" , args ));
321
+ if (logger .isLoggable (Level .FINE )) {
322
+ logger .fine (String .format ("emitting event %s" , args ));
323
+ }
320
324
321
325
if (packet .id >= 0 ) {
322
326
logger .fine ("attaching ack callback to event" );
@@ -343,7 +347,9 @@ public void call(final Object... args) {
343
347
public void run () {
344
348
if (sent [0 ]) return ;
345
349
sent [0 ] = true ;
346
- logger .fine (String .format ("sending ack %s" , args .length != 0 ? args : null ));
350
+ if (logger .isLoggable (Level .FINE )) {
351
+ logger .fine (String .format ("sending ack %s" , args .length != 0 ? args : null ));
352
+ }
347
353
348
354
JSONArray jsonArgs = new JSONArray ();
349
355
for (Object arg : args ) {
@@ -362,10 +368,14 @@ public void run() {
362
368
private void onack (Packet <JSONArray > packet ) {
363
369
Ack fn = this .acks .remove (packet .id );
364
370
if (fn != null ) {
365
- logger .fine (String .format ("calling ack %s with %s" , packet .id , packet .data ));
371
+ if (logger .isLoggable (Level .FINE )) {
372
+ logger .fine (String .format ("calling ack %s with %s" , packet .id , packet .data ));
373
+ }
366
374
fn .call (toArray (packet .data ));
367
375
} else {
368
- logger .fine (String .format ("bad ack %s" , packet .id ));
376
+ if (logger .isLoggable (Level .FINE )) {
377
+ logger .fine (String .format ("bad ack %s" , packet .id ));
378
+ }
369
379
}
370
380
}
371
381
@@ -391,7 +401,9 @@ private void emitBuffered() {
391
401
}
392
402
393
403
private void ondisconnect () {
394
- logger .fine (String .format ("server disconnect (%s)" , this .nsp ));
404
+ if (logger .isLoggable (Level .FINE )) {
405
+ logger .fine (String .format ("server disconnect (%s)" , this .nsp ));
406
+ }
395
407
this .destroy ();
396
408
this .onclose ("io server disconnect" );
397
409
}
@@ -418,7 +430,9 @@ public Socket close() {
418
430
@ Override
419
431
public void run () {
420
432
if (Socket .this .connected ) {
421
- logger .fine (String .format ("performing disconnect (%s)" , Socket .this .nsp ));
433
+ if (logger .isLoggable (Level .FINE )) {
434
+ logger .fine (String .format ("performing disconnect (%s)" , Socket .this .nsp ));
435
+ }
422
436
Socket .this .packet (new Packet (Parser .DISCONNECT ));
423
437
}
424
438
0 commit comments