You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by wg...@apache.org on 2005/01/25 19:27:46 UTC
svn commit: r126407 - /jakarta/velocity/trunk/src/java/org/apache/velocity/util/SimplePool.java
Author: wglass
Date: Tue Jan 25 10:27:41 2005
New Revision: 126407
URL: http://svn.apache.org/viewcvs?view=rev&rev=126407
Log:
updated license to ASL 2.0
Modified:
jakarta/velocity/trunk/src/java/org/apache/velocity/util/SimplePool.java
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/util/SimplePool.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/util/SimplePool.java?view=diff&rev=126407&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/util/SimplePool.java&r1=126406&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/util/SimplePool.java&r2=126407
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/util/SimplePool.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/util/SimplePool.java Tue Jan 25 10:27:41 2005
@@ -1,68 +1,22 @@
package org.apache.velocity.util;
/*
- * $Header: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/util/SimplePool.java,v 1.5 2004/03/20 03:35:51 dlr Exp $
- * $Revision: 1.5 $
- * $Date: 2004/03/20 03:35:51 $
- *
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2003 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", "Velocity", 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 apache@apache.org.
- *
- * 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]
+ * Copyright 2001-2004 The Apache Software Foundation.
*
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
+
/**
* Simple object pool. Based on ThreadPool and few other classes
*
@@ -71,9 +25,9 @@
* @author Gal Shachor
* @author Costin
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: SimplePool.java,v 1.5 2004/03/20 03:35:51 dlr Exp $
+ * @version $Id$
*/
-public final class SimplePool
+public final class SimplePool
{
/*
* Where the objects are held.
@@ -84,27 +38,27 @@
* max amount of objects to be managed
* set via CTOR
*/
- private int max;
-
+ private int max;
+
/**
* index of previous to next
* free slot
*/
private int current=-1;
-
- public SimplePool(int max)
+
+ public SimplePool(int max)
{
this.max = max;
pool = new Object[max];
- }
+ }
/**
* Add the object to the pool, silent nothing if the pool is full
*/
- public void put(Object o)
+ public void put(Object o)
{
int idx=-1;
-
+
synchronized(this)
{
/*
@@ -114,7 +68,7 @@
if (current < max - 1)
{
/*
- * then increment the
+ * then increment the
* current index.
*/
idx = ++current;
@@ -151,20 +105,20 @@
return o;
}
}
-
+
return null;
}
/** Return the size of the pool
*/
- public int getMax()
+ public int getMax()
{
return max;
}
/**
* for testing purposes, so we can examine the pool
- *
+ *
* @return
*/
Object[] getPool()
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org