jboutcher    02/03/15 05:28:56

  Modified:    src/org/apache/jmeter/protocol/http/sampler HTTPSampler.java
  Log:
  only will print one debug message about the target it's sampling to stdout.. holds 
back the flood.
  
  Revision  Changes    Path
  1.34      +25 -3     
jakarta-jmeter/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
  
  Index: HTTPSampler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- HTTPSampler.java  16 Feb 2002 03:59:11 -0000      1.33
  +++ HTTPSampler.java  15 Mar 2002 13:28:56 -0000      1.34
  @@ -78,14 +78,15 @@
   import java.util.Collection;
   import java.util.HashMap;
   import java.util.Iterator;
  +import java.util.ArrayList;
   
   /**
    *  A sampler which understands all the parts necessary to read statistics about
    *  HTTP requests, including cookies and authentication.
    *
    *@author     Michael Stover
  - *@created    $Date: 2002/02/16 03:59:11 $
  - *@version    $Revision: 1.33 $
  + *@created    $Date: 2002/03/15 13:28:56 $
  + *@version    $Revision: 1.34 $
    */
   public class HTTPSampler implements Sampler
   {
  @@ -145,6 +146,10 @@
        private static Category catClass = Category.getInstance(
                HTTPSampler.class.getName());
   
  +        /** Holds a list of URLs sampled - so we're not flooding stdout with
  +         *  debug information */
  +        private ArrayList m_sampledURLs = new ArrayList();
  +
        /**
         *  Constructor for the HTTPSampler object
         */
  @@ -429,7 +434,24 @@
                        res.putValue(HTTPSampler.URL,u);
                        // specify the data to the result.
                        res.putValue(HttpSampleResult.DATA, url);
  -                     System.out.println("Sampling url: " + u);
  +
  +                        /**
  +                         * Whenever someone gets around to going through and 
removing all
  +                         * these writes to stdout, feel free to remove this 
message-caching
  +                         * code and just send the sampling message to the logger.. 
JKB
  +                         */
  +
  +                        // Only want to send this debug info to stdout once..
  +                        if(!m_sampledURLs.contains(u)) {
  +                          // and we also don't want to gobble up too much memory..
  +                          if(m_sampledURLs.size() < 300) {
  +                            m_sampledURLs.add(u);
  +                            System.out.println("Sampling url: " + u);
  +                          }
  +                        }
  +
  +                        /** END - cached logging hack */
  +
                        if(catClass.isDebugEnabled())
                        {
                                catClass.debug("sample2 : sampling url - " + u);
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to