costin      00/12/07 11:52:57

  Modified:    src/share/org/apache/jasper/runtime JspFactoryImpl.java
               src/share/org/apache/tomcat/core Handler.java
               src/share/org/apache/tomcat/session
                        ServerSessionManager.java
               src/share/org/apache/tomcat/util/log LogEntry.java
                        QueueLogger.java
               src/share/org/apache/tomcat/util/net PoolTcpEndpoint.java
  Added:       src/share/org/apache/tomcat/util/collections
                        EmptyEnumeration.java Queue.java SimplePool.java
  Removed:     src/share/org/apache/tomcat/util ArrayEnumerator.java
                        DevNullOutputStream.java EmptyEnumeration.java
                        Queue.java SimplePool.java
  Log:
  Removed old unused code.
  
  Moved EmptyEnumeration, Queue, SimplePool to collections.
  The util package needs a better organization to avoid name polution and
  make it more (re)useable.
  
  Revision  Changes    Path
  1.7       +4 -4      
jakarta-tomcat/src/share/org/apache/jasper/runtime/JspFactoryImpl.java
  
  Index: JspFactoryImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspFactoryImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JspFactoryImpl.java       2000/09/29 07:00:38     1.6
  +++ JspFactoryImpl.java       2000/12/07 19:52:42     1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspFactoryImpl.java,v 1.6 
2000/09/29 07:00:38 costin Exp $
  - * $Revision: 1.6 $
  - * $Date: 2000/09/29 07:00:38 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspFactoryImpl.java,v 1.7 
2000/12/07 19:52:42 costin Exp $
  + * $Revision: 1.7 $
  + * $Date: 2000/12/07 19:52:42 $
    *
    * ====================================================================
    * 
  @@ -68,7 +68,7 @@
   import javax.servlet.jsp.JspEngineInfo;
   import javax.servlet.jsp.PageContext;
   
  -import org.apache.tomcat.util.SimplePool;
  +import org.apache.tomcat.util.collections.SimplePool;
   import org.apache.tomcat.util.log.*;
   
   /**
  
  
  
  1.24      +1 -0      jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java
  
  Index: Handler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Handler.java      2000/12/06 03:59:30     1.23
  +++ Handler.java      2000/12/07 19:52:45     1.24
  @@ -59,6 +59,7 @@
   package org.apache.tomcat.core;
   
   import org.apache.tomcat.util.*;
  +import org.apache.tomcat.util.collections.EmptyEnumeration;
   import java.io.*;
   import java.net.*;
   import java.util.*;
  
  
  
  1.14      +1 -0      
jakarta-tomcat/src/share/org/apache/tomcat/session/ServerSessionManager.java
  
  Index: ServerSessionManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/ServerSessionManager.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ServerSessionManager.java 2000/11/22 00:09:59     1.13
  +++ ServerSessionManager.java 2000/12/07 19:52:46     1.14
  @@ -63,6 +63,7 @@
   import java.io.IOException;
   import java.util.*;
   import org.apache.tomcat.util.*;
  +import org.apache.tomcat.util.collections.SimplePool;
   import org.apache.tomcat.util.threads.*;
   import org.apache.tomcat.helper.*;
   import org.apache.tomcat.core.*;
  
  
  
  1.1                  
jakarta-tomcat/src/share/org/apache/tomcat/util/collections/EmptyEnumeration.java
  
  Index: EmptyEnumeration.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  package org.apache.tomcat.util.collections;
  
  import java.util.Enumeration;
  import java.util.NoSuchElementException;
  
  public class EmptyEnumeration implements Enumeration {
  
      static EmptyEnumeration staticInstance=new EmptyEnumeration();
  
      public EmptyEnumeration() {
      }
  
      public static Enumeration getEmptyEnumeration() {
        return staticInstance;
      }
      
      public Object nextElement( ) {
        throw new NoSuchElementException( "EmptyEnumeration");
      }
  
      public boolean hasMoreElements() {
        return false;
      }
      
  }
  
  
  
  1.1                  
jakarta-tomcat/src/share/org/apache/tomcat/util/collections/Queue.java
  
  Index: Queue.java
  ===================================================================
  /*
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  package org.apache.tomcat.util.collections;
  
  import java.util.Vector;
  
  /**
   * A simple FIFO queue class which causes the calling thread to wait
   * if the queue is empty and notifies threads that are waiting when it
   * is not empty.
   *
   * @author Anil V ([EMAIL PROTECTED])
   */
  public class Queue {
      private Vector vector = new Vector();
  
      /** 
       * Put the object into the queue.
       * 
       * @param object          the object to be appended to the
       *                                queue. 
       */
      public synchronized void put(Object object) {
        vector.addElement(object);
        notify();
      }
      
      /**
       * Pull the first object out of the queue. Wait if the queue is
       * empty.
       */
      public synchronized Object pull() {
        while (isEmpty())
            try {
                wait();
            } catch (InterruptedException ex) {
            }
        return get();
      }
  
      /**
       * Get the first object out of the queue. Return null if the queue
       * is empty. 
       */
      public synchronized Object get() {
        Object object = peek();
        if (object != null)
            vector.removeElementAt(0);
        return object;
      }
  
      /**
       * Peek to see if something is available.
       */
      public Object peek() {
        if (isEmpty())
            return null;
        return vector.elementAt(0);
      }
      
      /**
       * Is the queue empty?
       */
      public boolean isEmpty() {
        return vector.isEmpty();
      }
  
      /**
       * How many elements are there in this queue?
       */
      public int size() {
        return vector.size();
      }
  }
  
  
  
  1.1                  
jakarta-tomcat/src/share/org/apache/tomcat/util/collections/SimplePool.java
  
  Index: SimplePool.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.tomcat.util.collections;
  
  import java.util.zip.*;
  import java.net.*;
  import java.util.*;
  import java.io.*;
  
  /**
   * Simple object pool. Based on ThreadPool and few other classes
   *
   * The pool will ignore overflow and return null if empty.
   *
   * @author Gal Shachor
   * @author Costin
   */
  public final class SimplePool  {
      /*
       * Where the threads are held.
       */
      private Object pool[];
  
      private int max;
      private int minSpare;
      private int maxSpare;
  
      private int current=-1;
  
      Object lock;
      public static final int DEFAULT_SIZE=16;
      
      public SimplePool() {
        this.max=DEFAULT_SIZE;
        pool=new Object[max];
        lock=new Object();
      }
  
      public SimplePool(int max) {
        this.max=max;
        pool=new Object[max];
        lock=new Object();
      }
  
      public  void set(Object o) {
        put(o);
      }
      /**
       * Add the object to the pool, silent nothing if the pool is full
       */
      public  void put(Object o) {
        int idx=-1;
        synchronized( lock ) {
            if( current < max - 1 )
                idx=++current;
            if( idx >= 0 ) 
                pool[idx]=o;
        }
      }
  
      /**
       * Get an object from the pool, null if the pool is empty.
       */
      public  Object get() {
        int idx=-1;
        synchronized( lock ) {
            if( current >= 0 )
                idx=current--;
            if( idx >= 0  ) 
                return pool[idx];
        }
        return null;
      }
  
      /** Return the size of the pool
       */
      public int getMax() {
        return max;
      }
  
  }
  
  
  
  1.2       +0 -2      
jakarta-tomcat/src/share/org/apache/tomcat/util/log/LogEntry.java
  
  Index: LogEntry.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/log/LogEntry.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LogEntry.java     2000/12/05 23:31:16     1.1
  +++ LogEntry.java     2000/12/07 19:52:52     1.2
  @@ -62,8 +62,6 @@
   
   import java.util.Date;
   
  -import org.apache.tomcat.util.Queue;
  -
   /**
    * This is an entry that is created in response to every
    * Logger.log(...) call.
  
  
  
  1.3       +1 -1      
jakarta-tomcat/src/share/org/apache/tomcat/util/log/QueueLogger.java
  
  Index: QueueLogger.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/log/QueueLogger.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- QueueLogger.java  2000/12/05 23:31:16     1.2
  +++ QueueLogger.java  2000/12/07 19:52:53     1.3
  @@ -62,7 +62,7 @@
   
   import java.util.Date;
   
  -import org.apache.tomcat.util.Queue;
  +import org.apache.tomcat.util.collections.Queue;
   
   /**
    * A real implementation of the Logger abstraction.
  
  
  
  1.6       +4 -3      
jakarta-tomcat/src/share/org/apache/tomcat/util/net/PoolTcpEndpoint.java
  
  Index: PoolTcpEndpoint.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PoolTcpEndpoint.java      2000/09/29 07:01:53     1.5
  +++ PoolTcpEndpoint.java      2000/12/07 19:52:56     1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v 
1.5 2000/09/29 07:01:53 costin Exp $
  - * $Revision: 1.5 $
  - * $Date: 2000/09/29 07:01:53 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v 
1.6 2000/12/07 19:52:56 costin Exp $
  + * $Revision: 1.6 $
  + * $Date: 2000/12/07 19:52:56 $
    *
    * ====================================================================
    *
  @@ -65,6 +65,7 @@
   package org.apache.tomcat.util.net;
   
   import org.apache.tomcat.util.*;
  +import org.apache.tomcat.util.collections.SimplePool;
   import org.apache.tomcat.util.threads.*;
   import org.apache.tomcat.util.log.*;
   import java.io.*;
  
  
  

Reply via email to