CVS: beepcore-java/src/org/beepcore/beep/transport/tcp TCPSession.java,1.25,1.26

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

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

Index: TCPSession.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp/TCPSession.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** TCPSession.java	7 Sep 2002 15:11:22 -0000	1.25
--- TCPSession.java	5 Oct 2002 15:32:45 -0000	1.26
***************
*** 30,33 ****
--- 30,36 ----
  import java.util.StringTokenizer;
  
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ 
  import org.beepcore.beep.core.BEEPException;
  import org.beepcore.beep.core.Channel;
***************
*** 40,44 ****
  import org.beepcore.beep.util.BufferSegment;
  import org.beepcore.beep.util.HeaderParser;
- import org.beepcore.beep.util.Log;
  import org.beepcore.beep.util.StringUtil;
  
--- 43,46 ----
***************
*** 74,77 ****
--- 76,81 ----
  
      // Instance Data
+     private Log log = LogFactory.getLog(this.getClass());
+ 
      private byte headerBuffer[] = new byte[Frame.MAX_HEADER_SIZE];
      private byte[] outputBuf = new byte[0];
***************
*** 128,133 ****
              socket.setReceiveBufferSize(MAX_RECEIVE_BUFFER_SIZE);
          } catch (Exception x) {
!             Log.logEntry(Log.SEV_DEBUG,
!                          "Socket doesn't support setting receive buffer size");
          }
      }
--- 132,136 ----
              socket.setReceiveBufferSize(MAX_RECEIVE_BUFFER_SIZE);
          } catch (Exception x) {
!             log.debug("Socket doesn't support setting receive buffer size");
          }
      }
***************
*** 292,299 ****
                  os.flush();
  
!                 if (Log.isLogged(Log.SEV_DEBUG_VERBOSE)) {
!                     Log.logEntry(Log.SEV_DEBUG_VERBOSE, TCP_MAPPING,
!                                  "Wrote the following\n" +
!                                  new String(outputBuf, 0, n));
                  }
              }
--- 295,301 ----
                  os.flush();
  
!                 if (log.isTraceEnabled()) {
!                     log.trace("Wrote the following\n" +
!                               new String(outputBuf, 0, n));
                  }
              }
***************
*** 312,318 ****
              throws BEEPException
      {
!         Log.logEntry(Log.SEV_DEBUG, TCP_MAPPING,
!                      "Reset as "
!                      + (isInitiator() ? "INITIATOR" : "LISTENER"));
  
          Socket s = null;
--- 314,321 ----
              throws BEEPException
      {
!         if (log.isTraceEnabled()) {
!             log.trace("Reset as "
!                       + (isInitiator() ? "INITIATOR" : "LISTENER"));
!         }
  
          Socket s = null;
***************
*** 363,373 ****
              throws BEEPException
      {
!         if (Log.isLogged(Log.SEV_DEBUG)) {
!             Log.logEntry(Log.SEV_DEBUG, TCP_MAPPING,
!                          "update SEQ channel=" + channel.getNumber()
!                          + " prevSeq=" + previouslySeq + " curSeq="
!                          + currentSeq + " prevUsed=" + previouslyUsed
!                          + " curUsed=" + currentlyUsed + " bufSize="
!                          + bufferSize);
          }
  
--- 366,375 ----
              throws BEEPException
      {
!         if (log.isDebugEnabled()) {
!             log.debug("update SEQ channel=" + channel.getNumber()
!                       + " prevSeq=" + previouslySeq + " curSeq="
!                       + currentSeq + " prevUsed=" + previouslyUsed
!                       + " curUsed=" + currentlyUsed + " bufSize="
!                       + bufferSize);
          }
  
***************
*** 397,403 ****
  
          try {
!             if (Log.isLogged(Log.SEV_DEBUG)) {
!                 Log.logEntry(Log.SEV_DEBUG, TCP_MAPPING,
!                              "Wrote: " + sb.toString());
              }
  
--- 399,404 ----
  
          try {
!             if (log.isDebugEnabled()) {
!                 log.debug("Wrote: " + sb.toString());
              }
  
***************
*** 423,429 ****
  
              while (running) {
!                 if (Log.isLogged(Log.SEV_DEBUG_VERBOSE)) {
!                     Log.logEntry(Log.SEV_DEBUG_VERBOSE, TCP_MAPPING,
!                                  "Processing next frame");
                  }
  
--- 424,429 ----
  
              while (running) {
!                 if (log.isTraceEnabled()) {
!                     log.trace("Processing next frame");
                  }
  
***************
*** 458,462 ****
              }
          } catch (IOException e) {
!             Log.logEntry(Log.SEV_ERROR, TCP_MAPPING, e);
  
              socket = null;
--- 458,462 ----
              }
          } catch (IOException e) {
!             log.error(e);
  
              socket = null;
***************
*** 466,476 ****
              terminate("Session aborted by remote peer.");
          } catch (Throwable e) {
!             Log.logEntry(Log.SEV_ERROR, TCP_MAPPING, e);
              terminate(e.getMessage());
          }
  
!         Log.logEntry(Log.SEV_DEBUG, TCP_MAPPING,
!                      "Session listener thread exiting.  State = "
!                      + TCPSession.this.getState());
      }
  
--- 466,477 ----
              terminate("Session aborted by remote peer.");
          } catch (Throwable e) {
!             log.error(e);
              terminate(e.getMessage());
          }
  
!         if (log.isDebugEnabled()) {
!             log.debug("Session listener thread exiting.  State = "
!                       + TCPSession.this.getState());
!         }
      }
  
***************
*** 540,546 ****
          }
  
!         if (Log.isLogged(Log.SEV_DEBUG_VERBOSE)) {
!             Log.logEntry(Log.SEV_DEBUG_VERBOSE, TCP_MAPPING,
!                          new String(headerBuffer, 0, headerLength));
          }
  
--- 541,546 ----
          }
  
!         if (log.isTraceEnabled()) {
!             log.trace(new String(headerBuffer, 0, headerLength));
          }
  
***************
*** 584,590 ****
              }
  
!             if (Log.isLogged(Log.SEV_DEBUG_VERBOSE)) {
!                 Log.logEntry(Log.SEV_DEBUG_VERBOSE, TCP_MAPPING,
!                              new String(payload));
              }
  
--- 584,589 ----
              }
  
!             if (log.isTraceEnabled()) {
!                 log.trace(new String(payload));
              }
  



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