CVS: beepcore-java/src/org/beepcore/beep/core Channel.java,1.29,1.30

Huston Franklin <[email protected]> Sat, 05 Oct 2002 08:26:32 -0700
Newsgroups gmane.network.beep.beepcore.java.cvs
Message-ID <[email protected]>
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core
In directory usw-pr-cvs1:/tmp/cvs-serv5622/src/org/beepcore/beep/core

Modified Files:
	Channel.java 
Log Message:
changed to use commons-logging

Index: Channel.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Channel.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** Channel.java	7 Sep 2002 15:00:12 -0000	1.29
--- Channel.java	5 Oct 2002 15:26:30 -0000	1.30
***************
*** 23,28 ****
  import java.util.*;
  
  import org.beepcore.beep.util.BufferSegment;
- import org.beepcore.beep.util.Log;
  
  
--- 23,30 ----
  import java.util.*;
  
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ 
  import org.beepcore.beep.util.BufferSegment;
  
  
***************
*** 61,64 ****
--- 63,68 ----
      // instance variables
  
+     private Log log = LogFactory.getLog(this.getClass());
+ 
      /** syntax of messages */
      private String profile;
***************
*** 291,297 ****
              recvWindowSize = size;
  
!             Log.logEntry(Log.SEV_DEBUG_VERBOSE,
!                          "Buffer size for channel " + number + " set to "
!                          + recvWindowSize);
  
              // send a new SEQ message to update the buffer size
--- 295,302 ----
              recvWindowSize = size;
  
!             if (log.isDebugEnabled()) {
!                 log.debug("Buffer size for channel " + number + " set to "
!                           + recvWindowSize);
!             }
  
              // send a new SEQ message to update the buffer size
***************
*** 502,512 ****
                              m.sendERR(e);
                          } catch (BEEPException e2) {
!                             Log.logEntry(Log.SEV_ERROR, e2);
                          }
                      } catch (AbortChannelException e) {
                          try {
                              Channel.this.close();
                          } catch (BEEPException e2) {
!                             Log.logEntry(Log.SEV_ERROR, e2);
                          }
                      }
--- 507,518 ----
                              m.sendERR(e);
                          } catch (BEEPException e2) {
!                             log.error("Error sending ERR", e2);
                          }
                      } catch (AbortChannelException e) {
                          try {
+                             /* @todo change this to abort or something else */
                              Channel.this.close();
                          } catch (BEEPException e2) {
!                             log.error("Error closing channel", e2);
                          }
                      }
***************
*** 564,569 ****
                      // There are ANS messages on the queue for which we
                      // haven't received the last frame.
!                     Log.logEntry(Log.SEV_DEBUG,
!                                  "Received NUL before last ANS");
                      session.terminate("Received NUL before last ANS");
                  }
--- 570,574 ----
                      // There are ANS messages on the queue for which we
                      // haven't received the last frame.
!                     log.debug("Received NUL before last ANS");
                      session.terminate("Received NUL before last ANS");
                  }
***************
*** 574,580 ****
  
              mstatus.setMessageStatus(MessageStatus.MESSAGE_STATUS_RECEIVED_REPLY);
!             Log.logEntry(Log.SEV_DEBUG_VERBOSE,
!                          "Notifying reply listener =>" + replyListener +
!                          "for NUL message");
  
              replyListener.receiveNUL(m);
--- 579,586 ----
  
              mstatus.setMessageStatus(MessageStatus.MESSAGE_STATUS_RECEIVED_REPLY);
!             if (log.isDebugEnabled()) {
!                 log.debug("Notifying reply listener =>" + replyListener +
!                           "for NUL message");
!             }
  
              replyListener.receiveNUL(m);
***************
*** 662,674 ****
          synchronized (m) {
              if (m.isNotified() || ((this.notifyOnFirstFrame == false)
! 
!             //                && recvWindowUsed != recvWindowSize
!                                    && (recvSequence - prevAckno)
!                                    != (recvWindowSize - prevWindowUsed) &&
!                                    (frame.isLast() == false))) {
!                 Log.logEntry(Log.SEV_DEBUG_VERBOSE,
!                              "recvWindowUsed = " + recvWindowUsed
!                              + " recvWindowSize = " + recvWindowSize
!                              + "\t\r\nNot notifying frame listener.");
                  return;
              }
--- 668,680 ----
          synchronized (m) {
              if (m.isNotified() || ((this.notifyOnFirstFrame == false)
!                 && (recvSequence - prevAckno)
!                     != (recvWindowSize - prevWindowUsed) &&
!                 (frame.isLast() == false)))
!             {
!                 if (log.isDebugEnabled()) {
!                     log.debug("recvWindowUsed = " + recvWindowUsed
!                               + " recvWindowSize = " + recvWindowSize
!                               + "\t\r\nNot notifying frame listener.");
!                 }
                  return;
              }
***************
*** 677,682 ****
          }
  
!         Log.logEntry(Log.SEV_DEBUG_VERBOSE,
!                      "Notifying reply listener.=>" + replyListener);
  
          if (m.messageType == Message.MESSAGE_TYPE_RPY) {
--- 683,689 ----
          }
  
!         if (log.isDebugEnabled()) {
!             log.debug("Notifying reply listener.=>" + replyListener);
!         }
  
          if (m.messageType == Message.MESSAGE_TYPE_RPY) {
***************
*** 699,703 ****
      void postFrame(Frame frame) throws BEEPException
      {
!         Log.logEntry(Log.SEV_DEBUG_VERBOSE, "Channel::postFrame");
  
          boolean firstFrame = false;
--- 706,710 ----
      void postFrame(Frame frame) throws BEEPException
      {
!         log.trace("Channel::postFrame");
  
          boolean firstFrame = false;
***************
*** 814,818 ****
          // is this the last frame in the message?
          if (frame.isLast() == true) {
!             Log.logEntry(Log.SEV_DEBUG_VERBOSE, "Got the last frame");
          }
  
--- 821,825 ----
          // is this the last frame in the message?
          if (frame.isLast() == true) {
!             log.trace("Got the last frame");
          }
  
***************
*** 931,935 ****
                       * the error (e.g. close the channel or session).
                       */
!                     Log.logEntry(Log.SEV_ERROR, e);
                      status.setMessageStatus(MessageStatus.MESSAGE_STATUS_NOT_SENT);
  
--- 938,942 ----
                       * the error (e.g. close the channel or session).
                       */
!                     log.error("sendFrames", e);
                      status.setMessageStatus(MessageStatus.MESSAGE_STATUS_NOT_SENT);
  
***************
*** 957,962 ****
      synchronized void setState(int newState)
      {
!         Log.logEntry(Log.SEV_DEBUG_VERBOSE,
!                      "CH" + number + " state=" + newState);
  
          this.state = newState;
--- 964,968 ----
      synchronized void setState(int newState)
      {
!         log.trace("CH" + number + " state=" + newState);
  
          this.state = newState;
***************
*** 987,1000 ****
          int previousPeerWindowSize = peerWindowSize;
  
!         Log.logEntry(Log.SEV_DEBUG,
!                      "Channel.updatePeerReceiveBufferSize: size = " + size
!                      + " lastSeq = " + lastSeq + " sentSequence = "
!                      + sentSequence + " peerWindowSize = " + peerWindowSize);
  
          peerWindowSize = size - (int) (sentSequence - lastSeq);
  
!         Log.logEntry(Log.SEV_DEBUG,
!                      "Channel.updatePeerReceiveBufferSize: New window size = "
!                      + peerWindowSize);
  
          if ((previousPeerWindowSize == 0) && (peerWindowSize > 0)) {
--- 993,1006 ----
          int previousPeerWindowSize = peerWindowSize;
  
!         if (log.isDebugEnabled()) {
!             log.debug("Channel.updatePeerReceiveBufferSize: size = " + size
!                       + " lastSeq = " + lastSeq + " sentSequence = "
!                       + sentSequence + " peerWindowSize = " + peerWindowSize);
!         }
  
          peerWindowSize = size - (int) (sentSequence - lastSeq);
  
!         log.debug("Channel.updatePeerReceiveBufferSize: New window size = "
!                   + peerWindowSize);
  
          if ((previousPeerWindowSize == 0) && (peerWindowSize > 0)) {
***************
*** 1009,1019 ****
      {
          try {
!             Log.logEntry(Log.SEV_DEBUG_VERBOSE,
!                          "Freed up " + size + " bytes on channel " + number);
  
              recvWindowUsed -= size;
  
!             Log.logEntry(Log.SEV_DEBUG_VERBOSE,
!                          "recvWindowUsed = " + recvWindowUsed);
  
              if (session.updateMyReceiveBufferSize(this, prevAckno,
--- 1015,1027 ----
      {
          try {
!             if (log.isTraceEnabled()) {
!                 log.trace("Freed up " + size + " bytes on channel " + number);
!             }
  
              recvWindowUsed -= size;
  
!             if (log.isTraceEnabled()) {
!                 log.trace("recvWindowUsed = " + recvWindowUsed);
!             }
  
              if (session.updateMyReceiveBufferSize(this, prevAckno,
***************
*** 1028,1032 ****
  
              // do nothing
!             Log.logEntry(Log.SEV_ALERT, e);
          }
      }
--- 1036,1040 ----
  
              // do nothing
!             log.fatal("Error updating receive buffer size", e);
          }
      }



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf