User: ejort   
  Date: 02/01/04 23:52:21

  Modified:    src/main/org/jboss/mq/cluster/transport/udp UDPStream.java
                        UDPTransport.java
  Log:
  Guarded debug logging
  
  Revision  Changes    Path
  1.3       +3 -2      
jbossmq/src/main/org/jboss/mq/cluster/transport/udp/UDPStream.java
  
  Index: UDPStream.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/cluster/transport/udp/UDPStream.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UDPStream.java    2001/08/17 03:04:03     1.2
  +++ UDPStream.java    2002/01/05 07:52:21     1.3
  @@ -34,7 +34,7 @@
    *
    * @author     Hiram Chirino ([EMAIL PROTECTED])
    * @created    August 16, 2001
  - * @version    $Revision: 1.2 $
  + * @version    $Revision: 1.3 $
    */
   class UDPStream implements Runnable {
      // The name this stream.  Used to ease debugging.
  @@ -406,7 +406,8 @@
         UDPNodeId senderId = dg.getSenderId();
         int id = dg.getId();
         short fragmentId = dg.getFragmentId();
  -      cat.debug( "[" + this + "] Processing datagram: " + id );
  +      if (cat.isDebugEnabled())
  +         cat.debug( "[" + this + "] Processing datagram: " + id );
   
         NodeState nodeState = getNodeState( senderId );
         MessageState ds = getMessageState( nodeState, id );
  
  
  
  1.3       +27 -13    
jbossmq/src/main/org/jboss/mq/cluster/transport/udp/UDPTransport.java
  
  Index: UDPTransport.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/cluster/transport/udp/UDPTransport.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UDPTransport.java 2001/08/17 03:04:03     1.2
  +++ UDPTransport.java 2002/01/05 07:52:21     1.3
  @@ -38,7 +38,7 @@
    *
    * @author     Hiram Chirino ([EMAIL PROTECTED])
    * @created    August 16, 2001
  - * @version    $Revision: 1.2 $
  + * @version    $Revision: 1.3 $
    */
   public class UDPTransport implements Transport {
      // Receives the multicast messages
  @@ -126,7 +126,8 @@
               adminSocket = new DatagramSocket();
               nodeId.adminPort = adminSocket.getLocalPort();
   
  -            cat.debug( "[" + this + "] Local NodeId: " + nodeId );
  +            if (cat.isDebugEnabled())
  +               cat.debug( "[" + this + "] Local NodeId: " + nodeId );
   
               clusterId.address = group;
               clusterId.port = port;
  @@ -202,7 +203,8 @@
               data.length );
   
         dg.setId( adminStream.getNextDatagramId() );
  -      cat.debug( "[" + this + "] Sending admin datagram: " + dg.getId() );
  +      if (cat.isDebugEnabled())
  +         cat.debug( "[" + this + "] Sending admin datagram: " + dg.getId() );
         DatagramPacket packet = new java.net.DatagramPacket( dg.data, dg.data.length, 
dest.address, dest.adminPort );
         adminStream.socket.send( packet );
      }
  @@ -285,7 +287,9 @@
      void datagramArrived( Datagram dg )
         throws InterruptedException {
   
  -      cat.debug( "[" + this + "] A datagram arrived" );
  +      boolean debug = cat.isDebugEnabled();
  +      if (debug)
  +         cat.debug( "[" + this + "] A datagram arrived" );
   
         if ( dg.isMessageFlagsSet( Datagram.ADMIN_FLAG ) ) {
            try {
  @@ -300,13 +304,15 @@
   
                  ResendAdminDatagram radg = ( ResendAdminDatagram )o;
                  for ( int i = 0; i < radg.datagramIds.length; i++ ) {
  -                  cat.debug( "[" + this + "] RESEND REQUEST ARRIVED: " + 
radg.datagramIds[i] );
  +                  if (debug)
  +                     cat.debug( "[" + this + "] RESEND REQUEST ARRIVED: " + 
radg.datagramIds[i] );
                     resendDatagram( dg.getSenderId(), radg.datagramIds[i], 
radg.broadcast );
                  }
               } else if ( o instanceof ResendErrorAdminDatagram ) {
   
                  ResendErrorAdminDatagram readg = ( ResendErrorAdminDatagram )o;
  -               cat.debug( "[" + this + "] RESEND REQUEST FAILED: " + 
readg.datagramId );
  +               if (debug)
  +                  cat.debug( "[" + this + "] RESEND REQUEST FAILED: " + 
readg.datagramId );
                  if ( readg.broadcast ) {
                     broadcastStream.removeFromDatagramStream( dg.getSenderId(), 
readg.datagramId );
                  } else {
  @@ -351,24 +357,29 @@
      void resendDatagram( UDPNodeId requestor, int messageId, boolean broadcast )
         throws InterruptedException, java.io.IOException {
   
  +      boolean debug = cat.isDebugEnabled();
         slowDownSendRate();
         if ( broadcast ) {
            Datagram dg = broadcastStream.getFromSentCache( messageId );
            if ( dg != null ) {
  -            cat.debug( "[" + this + "] BROADCAST RESEND REQUEST SERVICED: " + 
messageId );
  +            if (debug)
  +               cat.debug( "[" + this + "] BROADCAST RESEND REQUEST SERVICED: " + 
messageId );
               send( dg, false );
               return;
            } else {
  -            cat.debug( "[" + this + "] BROADCAST RESEND REQUEST NOT SERVICED (not 
in cache): " + messageId );
  +            if (debug)
  +               cat.debug( "[" + this + "] BROADCAST RESEND REQUEST NOT SERVICED 
(not in cache): " + messageId );
            }
         } else {
            Datagram dg = pointStream.getFromSentCache( messageId );
            if ( dg != null ) {
  -            cat.debug( "[" + this + "] POINT RESEND REQUEST SERVICED: " + messageId 
);
  +            if (debug)
  +               cat.debug( "[" + this + "] POINT RESEND REQUEST SERVICED: " + 
messageId );
               send( requestor, dg, false );
               return;
            } else {
  -            cat.debug( "[" + this + "] POINT RESEND REQUEST NOT SERVICED (not in 
cache): " + messageId );
  +            if (debug)
  +               cat.debug( "[" + this + "] POINT RESEND REQUEST NOT SERVICED (not in 
cache): " + messageId );
            }
         }
   
  @@ -401,7 +412,8 @@
         broadcastStream.addToSentCache( dg );
   
         // Send the fragment chain.
  -      cat.debug( "[" + this + "] Sending Broadcast datagram: " + dg.getId() );
  +      if (cat.isDebugEnabled())
  +         cat.debug( "[" + this + "] Sending Broadcast datagram: " + dg.getId() );
         while ( dg != null ) {
   
            if ( setDatagramId ) {
  @@ -425,7 +437,8 @@
   
         pointStream.addToSentCache( dg );
   
  -      cat.debug( "[" + this + "] Sending Point datagram: " + dg.getId() );
  +      if (cat.isDebugEnabled())
  +         cat.debug( "[" + this + "] Sending Point datagram: " + dg.getId() );
         // Send the fragment chain.
         while ( dg != null ) {
            if ( setDatagramId ) {
  @@ -447,7 +460,8 @@
            msgs[i] = ( ( Integer )messageIds.elementAt( i ) ).intValue();
         }
   
  -      cat.debug( "[" + this + "] SENDING RESEND REQUEST: " + messageIds );
  +      if (cat.isDebugEnabled())
  +         cat.debug( "[" + this + "] SENDING RESEND REQUEST: " + messageIds );
         ResendAdminDatagram m = new ResendAdminDatagram( msgs, broadcast );
         try {
            adminSend( nodeId, m );
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to