[maven-release-plugin] copy for tag commons-jcs-2.0-beta-2
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/jcs/tags/commons-jcs-2.0-beta-2@1766068 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 51f5907..cce05fc 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -73,6 +73,10 @@
o JCS-48: Replace PoolAccess with a DataSourceFactory model borrowed from DB-Torque Thanks to Hanasaki Jiji.
o JCS-124: Make the code in Step 5 on the JCS overview page a full working class that can compile Thanks to Richard Eigenmann.
+Removed:
+o Remove size limitation configuration of indexed cache recycle bin
+o Replace SortedPreferentialArray with JDK ConcurrentSkipListSet
+o Replace SingleLinkedList with JDK ConcurrentLinkedQueue
Historical list of changes: http://commons.apache.org/proper/commons-jcs/changes-report.html
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java
index 2b7219f..261026a 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java
@@ -26,12 +26,12 @@
import java.io.Serializable;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
+import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.commons.jcs.engine.behavior.IElementSerializer;
import org.apache.commons.jcs.utils.serialization.StandardSerializer;
-import org.apache.commons.jcs.utils.struct.SingleLinkedList;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -63,7 +63,7 @@
private final AtomicInteger numberOfBlocks = new AtomicInteger(0);
/** Empty blocks that can be reused. */
- private final SingleLinkedList<Integer> emptyBlocks = new SingleLinkedList<Integer>();
+ private final ConcurrentLinkedQueue<Integer> emptyBlocks = new ConcurrentLinkedQueue<Integer>();
/** The serializer. */
private final IElementSerializer elementSerializer;
@@ -145,7 +145,7 @@
// get them from the empty list or take the next one
for (int i = 0; i < numBlocksNeeded; i++)
{
- Integer emptyBlock = emptyBlocks.takeFirst();
+ Integer emptyBlock = emptyBlocks.poll();
if (emptyBlock == null)
{
emptyBlock = Integer.valueOf(numberOfBlocks.getAndIncrement());
@@ -366,7 +366,7 @@
{
for ( short i = 0; i < blocksToFree.length; i++ )
{
- emptyBlocks.addLast( Integer.valueOf( blocksToFree[i] ) );
+ emptyBlocks.offer( Integer.valueOf( blocksToFree[i] ) );
}
}
}
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
index 6842187..707571b 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
@@ -558,7 +558,7 @@
return removed;
}
-
+
private boolean performSingleKeyRemoval(K key) {
boolean removed;
// remove single item.
@@ -733,17 +733,6 @@
}
/**
- * Gets basic stats for the disk cache.
- * <p>
- * @return String
- */
- @Override
- public String getStats()
- {
- return getStatistics().toString();
- }
-
- /**
* Returns info about the disk cache.
* <p>
* @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getStatistics()
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
index b39117c..28d79b2 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
@@ -33,6 +33,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -53,7 +54,6 @@
import org.apache.commons.jcs.engine.stats.behavior.IStats;
import org.apache.commons.jcs.utils.struct.AbstractLRUMap;
import org.apache.commons.jcs.utils.struct.LRUMap;
-import org.apache.commons.jcs.utils.struct.SortedPreferentialArray;
import org.apache.commons.jcs.utils.timing.ElapsedTimer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -114,10 +114,11 @@
private boolean queueInput = false;
/** list where puts made during optimization are made */
- private final LinkedList<IndexedDiskElementDescriptor> queuedPutList = new LinkedList<IndexedDiskElementDescriptor>();
+ private final ConcurrentSkipListSet<IndexedDiskElementDescriptor> queuedPutList =
+ new ConcurrentSkipListSet<IndexedDiskElementDescriptor>(new PositionComparator());
/** RECYLCE BIN -- array of empty spots */
- private SortedPreferentialArray<IndexedDiskElementDescriptor> recycle;
+ private ConcurrentSkipListSet<IndexedDiskElementDescriptor> recycle;
/** User configurable parameters */
private final IndexedDiskCacheAttributes cattr;
@@ -198,7 +199,7 @@
doOptimizeRealTime();
}
}
- catch (Exception e)
+ catch (IOException e)
{
log.error(
logCacheName + "Failure initializing for fileName: " + fileName + " and directory: "
@@ -229,9 +230,8 @@
*
* @param cattr
* @throws IOException
- * @throws InterruptedException
*/
- private void initializeKeysAndData(IndexedDiskCacheAttributes cattr) throws IOException, InterruptedException
+ private void initializeKeysAndData(IndexedDiskCacheAttributes cattr) throws IOException
{
this.dataFile = new IndexedDisk(new File(rafDir, fileName + ".data"), getElementSerializer());
this.keyFile = new IndexedDisk(new File(rafDir, fileName + ".key"), getElementSerializer());
@@ -279,10 +279,9 @@
* files are cleared.
* <p>
*
- * @throws InterruptedException
* @throws IOException
*/
- private void initializeStoreFromPersistedData() throws InterruptedException, IOException
+ private void initializeStoreFromPersistedData() throws IOException
{
loadKeys();
@@ -313,11 +312,8 @@
/**
* Loads the keys from the .key file. The keys are stored in a HashMap on disk. This is
* converted into a LRUMap.
- * <p>
- *
- * @throws InterruptedException
*/
- protected void loadKeys() throws InterruptedException
+ protected void loadKeys()
{
if (log.isDebugEnabled())
{
@@ -331,8 +327,8 @@
// create a key map to use.
initializeKeyMap();
- HashMap<K, IndexedDiskElementDescriptor> keys = keyFile.readObject(new IndexedDiskElementDescriptor(0, (int) keyFile
- .length() - IndexedDisk.HEADER_SIZE_BYTES));
+ HashMap<K, IndexedDiskElementDescriptor> keys = keyFile.readObject(
+ new IndexedDiskElementDescriptor(0, (int) keyFile.length() - IndexedDisk.HEADER_SIZE_BYTES));
if (keys != null)
{
@@ -406,7 +402,7 @@
isOk = checkForDedOverlaps(createPositionSortedDescriptorList());
}
}
- catch (Exception e)
+ catch (IOException e)
{
log.error(e);
isOk = false;
@@ -484,7 +480,7 @@
log.info(logCacheName + "Finished saving keys.");
}
}
- catch (Exception e)
+ catch (IOException e)
{
log.error(logCacheName + "Problem storing keys.", e);
}
@@ -543,9 +539,11 @@
if (doRecycle)
{
- IndexedDiskElementDescriptor rep = recycle.takeNearestLargerOrEqual(ded);
+ IndexedDiskElementDescriptor rep = recycle.ceiling(ded);
if (rep != null)
{
+ // remove element from recycle bin
+ recycle.remove(rep);
ded = rep;
ded.len = data.length;
recycleCnt++;
@@ -600,7 +598,7 @@
log.debug(logCacheName + "Caught ConcurrentModificationException." + cme);
}
}
- catch (Exception e)
+ catch (IOException e)
{
log.error(logCacheName + "Failure updating element, key: " + ce.getKey() + " old: " + old, e);
}
@@ -651,10 +649,6 @@
log.error(logCacheName + "Failure getting from disk, key = " + key, ioe);
reset();
}
- catch (Exception e)
- {
- log.error(logCacheName + "Failure getting from disk, key = " + key, e);
- }
return object;
}
@@ -670,33 +664,26 @@
public Map<K, ICacheElement<K, V>> processGetMatching(String pattern)
{
Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
+ Set<K> keyArray = null;
+ storageLock.readLock().lock();
try
{
- Set<K> keyArray = null;
- storageLock.readLock().lock();
- try
- {
- keyArray = new HashSet<K>(keyHash.keySet());
- }
- finally
- {
- storageLock.readLock().unlock();
- }
-
- Set<K> matchingKeys = getKeyMatcher().getMatchingKeysFromArray(pattern, keyArray);
-
- for (K key : matchingKeys)
- {
- ICacheElement<K, V> element = processGet(key);
- if (element != null)
- {
- elements.put(key, element);
- }
- }
+ keyArray = new HashSet<K>(keyHash.keySet());
}
- catch (Exception e)
+ finally
{
- log.error(logCacheName + "Failure getting matching from disk, pattern = " + pattern, e);
+ storageLock.readLock().unlock();
+ }
+
+ Set<K> matchingKeys = getKeyMatcher().getMatchingKeysFromArray(pattern, keyArray);
+
+ for (K key : matchingKeys)
+ {
+ ICacheElement<K, V> element = processGet(key);
+ if (element != null)
+ {
+ elements.put(key, element);
+ }
}
return elements;
}
@@ -808,11 +795,6 @@
removed = performSingleKeyRemoval(key);
}
}
- catch (Exception e)
- {
- log.error(logCacheName + "Problem removing element.", e);
- reset = true;
- }
finally
{
storageLock.writeLock().unlock();
@@ -945,11 +927,6 @@
{
reset();
}
- catch (Exception e)
- {
- log.error(logCacheName + "Problem removing all.", e);
- reset();
- }
finally
{
logICacheEvent(cacheEvent);
@@ -957,7 +934,7 @@
}
/**
- * Reset effectively clears the disk cache, creating new files, recyclebins, and keymaps.
+ * Reset effectively clears the disk cache, creating new files, recycle bins, and keymaps.
* <p>
* It can be used to handle errors by last resort, force content update, or removeall.
*/
@@ -965,7 +942,7 @@
{
if (log.isWarnEnabled())
{
- log.warn(logCacheName + "Reseting cache");
+ log.warn(logCacheName + "Resetting cache");
}
try
@@ -1017,12 +994,7 @@
*/
private void initializeRecycleBin()
{
- int recycleBinSize = cattr.getMaxRecycleBinSize() >= 0 ? cattr.getMaxRecycleBinSize() : 0;
- recycle = new SortedPreferentialArray<IndexedDiskElementDescriptor>(recycleBinSize);
- if (log.isDebugEnabled())
- {
- log.debug(logCacheName + "Set recycle max Size to MaxRecycleBinSize: '" + recycleBinSize + "'");
- }
+ recycle = new ConcurrentSkipListSet<IndexedDiskElementDescriptor>();
}
/**
@@ -1165,8 +1137,6 @@
* (2) When an item on disk is updated with a value that will not fit in the previous slot. (3) When the max key size is
* reached, the freed slot will be added.
* <p>
- * The recylebin is not a set. If a slot it added twice, it will result in the wrong data being returned.
- * <p>
*
* @param ded
*/
@@ -1306,10 +1276,7 @@
{
if (!queuedPutList.isEmpty())
{
- // This is perhaps unnecessary, but the list might not be as sorted as we think.
- defragList = new IndexedDiskElementDescriptor[queuedPutList.size()];
- queuedPutList.toArray(defragList);
- Arrays.sort(defragList, new PositionComparator());
+ defragList = queuedPutList.toArray(new IndexedDiskElementDescriptor[queuedPutList.size()]);
// pack them at the end
expectedNextPos = defragFile(defragList, expectedNextPos);
@@ -1317,7 +1284,7 @@
// TRUNCATE THE FILE
dataFile.truncate(expectedNextPos);
}
- catch (Exception e)
+ catch (IOException e)
{
log.error(logCacheName + "Error optimizing queued puts.", e);
}
@@ -1441,7 +1408,7 @@
}
/**
- * Returns the size of the recyclebin in number of elements.
+ * Returns the size of the recycle bin in number of elements.
* <p>
*
* @return The number of items in the bin.
@@ -1576,21 +1543,8 @@
}
/**
- * Gets basic stats for the disk cache.
- * <p>
- *
- * @return String
- */
- @Override
- public String getStats()
- {
- return getStatistics().toString();
- }
-
- /**
* Returns info about the disk cache.
* <p>
- * (non-Javadoc)
*
* @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getStatistics()
*/
@@ -1609,7 +1563,7 @@
elems
.add(new StatElement<Long>("Data File Length", Long.valueOf(this.dataFile != null ? this.dataFile.length() : -1L)));
}
- catch (Exception e)
+ catch (IOException e)
{
log.error(e);
}
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheAttributes.java
index e946c33..fffaadb 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheAttributes.java
@@ -36,14 +36,6 @@
/** -1 means no limit. */
private int maxKeySize = DEFAULT_maxKeySize;
- /** default value */
- private static final int DEFAULT_maxRecycleBinSize = 5000;
-
- /**
- * Cannot be larger than the max size. If max is less than 0, this will be 5000
- */
- private int maxRecycleBinSize = DEFAULT_maxRecycleBinSize;
-
/** default to -1, i.e., don't optimize until shutdown */
private int optimizeAtRemoveCount = -1;
@@ -56,7 +48,7 @@
/** Should we clear the disk on startup. */
public static final boolean DEFAULT_CLEAR_DISK_ON_STARTUP = false;
- /** Should we clear the disk on startup. If true the congtents of disk are cleared. */
+ /** Should we clear the disk on startup. If true the contents of disk are cleared. */
private boolean clearDiskOnStartup = DEFAULT_CLEAR_DISK_ON_STARTUP;
/**
@@ -85,9 +77,6 @@
public void setMaxKeySize( int maxKeySize )
{
this.maxKeySize = maxKeySize;
-
- // make sure the sizes are in accord with our rule.
- setMaxRecycleBinSize( maxRecycleBinSize );
}
/**
@@ -112,27 +101,6 @@
}
/**
- * This cannot be larger than the maxKeySize. It wouldn't hurt anything, but it makes the config
- * necessary. The recycle bin entry willbe at least as large as a key.
- * <p>
- * If the maxKeySize is -1 this will be set tot he default, which is 5000.
- * <p>
- * @param maxRecycleBinSize The maxRecycleBinSize to set.
- */
- public void setMaxRecycleBinSize( int maxRecycleBinSize )
- {
- this.maxRecycleBinSize = maxRecycleBinSize;
- }
-
- /**
- * @return Returns the maxRecycleBinSize.
- */
- public int getMaxRecycleBinSize()
- {
- return maxRecycleBinSize;
- }
-
- /**
* @param optimizeOnShutdown The optimizeOnShutdown to set.
*/
public void setOptimizeOnShutdown( boolean optimizeOnShutdown )
@@ -177,7 +145,6 @@
str.append( "\n diskPath = " + super.getDiskPath() );
str.append( "\n maxPurgatorySize = " + super.getMaxPurgatorySize() );
str.append( "\n maxKeySize = " + maxKeySize );
- str.append( "\n maxRecycleBinSize = " + maxRecycleBinSize );
str.append( "\n optimizeAtRemoveCount = " + optimizeAtRemoveCount );
str.append( "\n shutdownSpoolTimeLimit = " + super.getShutdownSpoolTimeLimit() );
str.append( "\n optimizeOnShutdown = " + optimizeOnShutdown );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskElementDescriptor.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskElementDescriptor.java
index 12435c1..5f5af18 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskElementDescriptor.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskElementDescriptor.java
@@ -78,16 +78,21 @@
@Override
public boolean equals(Object o)
{
- if (o instanceof IndexedDiskElementDescriptor)
+ if (o == null)
+ {
+ return false;
+ }
+ else if (o instanceof IndexedDiskElementDescriptor)
{
- return compareTo((IndexedDiskElementDescriptor) o) == 0;
+ IndexedDiskElementDescriptor ided = (IndexedDiskElementDescriptor)o;
+ return pos == ided.pos && len == ided.len;
}
return false;
}
/**
- * Compares based on length.
+ * Compares based on length, then on pos descending.
* <p>
* @param o Object
* @return int
@@ -100,19 +105,28 @@
return 1;
}
- int oLen = o.len;
- if ( oLen == len )
+ if ( o.len == len )
{
- return 0;
+ if ( o.pos == pos )
+ {
+ return 0;
+ }
+ else if ( o.pos < pos )
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
}
- else if ( oLen > len )
+ else if ( o.len > len )
{
return -1;
}
- else if ( oLen < len )
+ else
{
return 1;
}
- return 0;
}
}
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java
index d4600c7..122dbaa 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java
@@ -470,7 +470,6 @@
/**
* Returns the stats and the cache.toString().
* <p>
- * (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/SingleLinkedList.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/SingleLinkedList.java
deleted file mode 100644
index 0e0f5f3..0000000
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/SingleLinkedList.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package org.apache.commons.jcs.utils.struct;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * This is an basic thread safe single linked list. It provides very limited functionality. It is
- * small and fast.
- * <p>
- * @author Aaron Smuts
- */
-public class SingleLinkedList<T>
-{
- /** The logger */
- private static final Log log = LogFactory.getLog( SingleLinkedList.class );
-
- /** for sync */
- private final Object lock = new Object();
-
- /** the head of the queue */
- private Node<T> head = new Node<T>();
-
- /** the end of the queue */
- private Node<T> tail = head;
-
- /** The size of the list */
- private int size = 0;
-
- /**
- * Takes the first item off the list.
- * <p>
- * @return null if the list is empty.
- */
- public T takeFirst()
- {
- synchronized ( lock )
- {
- // wait until there is something to read
- if ( head == tail )
- {
- return null;
- }
-
- Node<T> node = head.next;
-
- T value = node.payload;
-
- if ( log.isDebugEnabled() )
- {
- log.debug( "head.payload = " + head.payload );
- log.debug( "node.payload = " + node.payload );
- }
-
- // Node becomes the new head (head is always empty)
-
- node.payload = null;
- head = node;
-
- size--;
- return value;
- }
- }
-
- /**
- * Adds an item to the end of the list.
- * <p>
- * @param payload
- */
- public void addLast( T payload )
- {
- Node<T> newNode = new Node<T>();
-
- newNode.payload = payload;
-
- synchronized ( lock )
- {
- size++;
- tail.next = newNode;
- tail = newNode;
- }
- }
-
- /**
- * Removes everything.
- */
- public void clear()
- {
- synchronized ( lock )
- {
- head = tail;
- size = 0;
- }
- }
-
- /**
- * The list is composed of nodes.
- * <p>
- * @author Aaron Smuts
- */
- protected static class Node<T>
- {
- /** next in the list */
- Node<T> next = null;
-
- /** The data in this node */
- T payload;
- }
-
- /**
- * Returns the number of elements in the list.
- * <p>
- * @return number of items in the list.
- */
- public int size()
- {
- return size;
- }
-}
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/SortedPreferentialArray.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/SortedPreferentialArray.java
deleted file mode 100644
index 165cf29..0000000
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/SortedPreferentialArray.java
+++ /dev/null
@@ -1,612 +0,0 @@
-package org.apache.commons.jcs.utils.struct;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * This maintains a sorted array with a preferential replacement policy when full.
- * <p>
- * Insertion time is n, search is log(n)
- * <p>
- * Clients must manage thread safety on previous version. I synchronized the public methods to add
- * easy thread safety. I synchronized all public methods that make modifications.
- */
-public class SortedPreferentialArray<T extends Comparable<? super T>>
-{
- /** The logger */
- private static final Log log = LogFactory.getLog( SortedPreferentialArray.class );
-
- /** prefer large means that the smallest will be removed when full. */
- private boolean preferLarge = true;
-
- /** maximum number allowed */
- private int maxSize = 0;
-
- /** The currency number */
- private int curSize = 0;
-
- /** The primary array */
- private final T[] array;
-
- /** the number that have been inserted. */
- private int insertCnt = 0;
-
- /**
- * Construct the array with the maximum size.
- * <p>
- * @param maxSize int
- */
- public SortedPreferentialArray( int maxSize )
- {
- this.maxSize = maxSize;
- @SuppressWarnings("unchecked") // No generic arrays in java
- T[] ts = (T[]) new Comparable<?>[maxSize];
- array = ts;
- }
-
- /**
- * If the array is full this will remove the smallest if preferLarge==true and if obj is bigger,
- * or the largest if preferLarge=false and obj is smaller than the largest.
- * <p>
- * @param obj Object
- */
- public synchronized void add(T obj)
- {
- if ( obj == null )
- {
- return;
- }
-
- if ( curSize < maxSize )
- {
- insert( obj );
- return;
- }
- if ( preferLarge )
- {
- // insert if obj is larger than the smallest
- T sma = getSmallest();
- if ( obj.compareTo( sma ) > 0 )
- {
- insert( obj );
- return;
- }
- // obj is less than or equal to the smallest.
- if ( log.isDebugEnabled() )
- {
- log.debug( "New object is smaller than or equal to the smallest" );
- }
- return;
- }
- // Not preferLarge
- T lar = getLargest();
- // insert if obj is smaller than the largest
- int diff = obj.compareTo( lar );
- if ( diff > 0 || diff == 0 )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( "New object is larger than or equal to the largest" );
- }
- return;
- }
- // obj is less than the largest.
- insert( obj );
- }
-
- /**
- * Returns the largest without removing it from the array.
- * <p>
- * @return Comparable
- */
- public synchronized T getLargest()
- {
- return array[curSize - 1];
- }
-
- /**
- * Returns the smallest element without removing it from the array.
- * <p>
- * @return Comparable
- */
- public synchronized T getSmallest()
- {
- return array[0];
- }
-
- /**
- * Insert looks for the nearest largest. It then determines which way to shuffle depending on
- * the preference.
- * <p>
- * @param obj Comparable
- */
- private void insert(T obj)
- {
- try
- {
- int nLar = findNearestLargerEqualOrLastPosition( obj );
- if ( log.isDebugEnabled() )
- {
- log.debug( "nLar = " + nLar + " obj = " + obj );
- }
-
- if ( nLar == curSize )
- {
- // this next check should be unnecessary
- // findNearestLargerPosition should only return the curSize if
- // there is
- // room left. Check to be safe
- if ( curSize < maxSize )
- {
- array[nLar] = obj;
- curSize++;
- if ( log.isDebugEnabled() )
- {
- log.debug( this.dumpArray() );
- }
- if ( log.isDebugEnabled() )
- {
- log.debug( "Inserted object at the end of the array" );
- }
- return;
- } // end if not full
- }
-
- boolean isFull = false;
- if ( curSize == maxSize )
- {
- isFull = true;
- }
-
- // The array is full, we must replace
- // remove smallest or largest to determine whether to
- // shuffle left or right to insert
- if ( preferLarge )
- {
- if ( isFull )
- {
- // is full, prefer larger, remove smallest by shifting left
- int pnt = nLar - 1; // set iteration stop point
- for ( int i = 0; i < pnt; i++ )
- {
- array[i] = array[i + 1];
- }
- // use nLar-1 for insertion point
- array[nLar - 1] = obj;
- if ( log.isDebugEnabled() )
- {
- log.debug( "Inserted object at " + ( nLar - 1 ) );
- }
- }
- else
- {
- // not full, shift right from spot
- int pnt = nLar; // set iteration stop point
- for ( int i = curSize; i > pnt; i-- )
- {
- array[i] = array[i - 1];
- }
- // use nLar-1 for insertion point
- array[nLar] = obj;
- curSize++;
- if ( log.isDebugEnabled() )
- {
- log.debug( "Inserted object at " + ( nLar ) );
- }
- }
- }
- else
- {
- // prefer smaller, remove largest by shifting right
- // use nLar for insertion point
- int pnt = nLar + 1;
- if ( !isFull )
- {
- pnt = nLar;
- }
- for ( int i = curSize; i > pnt; i-- )
- {
- array[i] = array[i - 1];
- }
- array[nLar] = obj;
- if ( log.isDebugEnabled() )
- {
- log.debug( "Inserted object at " + nLar );
- }
- }
-
- if ( log.isDebugEnabled() )
- {
- log.debug( this.dumpArray() );
- }
- }
- catch ( Exception e )
- {
- log.error( "Insertion problem" + this.dumpArray(), e );
- }
-
- insertCnt++;
- if ( insertCnt % 100 == 0 )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( this.dumpArray() );
- }
- }
- }
-
- /**
- * Determines whether the preference is for large or small.
- * <p>
- * @param pref boolean
- */
- public synchronized void setPreferLarge( boolean pref )
- {
- preferLarge = pref;
- }
-
- /**
- * Returns and removes the nearer larger or equal object from the aray.
- * <p>
- * @param obj Comparable
- * @return Comparable, null if arg is null or none was found.
- */
- public synchronized T takeNearestLargerOrEqual( T obj )
- {
- if ( obj == null )
- {
- return null;
- }
-
- T retVal = null;
- try
- {
- int pos = findNearestOccupiedLargerOrEqualPosition( obj );
- if ( pos == -1 )
- {
- return null;
- }
-
- try
- {
- retVal = array[pos];
- remove( pos );
- }
- catch ( Exception e )
- {
- log.error( "Problem removing from array. pos [" + pos + "] " + obj, e );
- }
-
- if ( log.isDebugEnabled() )
- {
- log.debug( "obj = " + obj + " || retVal = " + retVal );
- }
- }
- catch ( Exception e )
- {
- log.error( "Take problem" + this.dumpArray(), e );
- }
- return retVal;
- }
-
- /**
- * Returns the current size of the array.
- * <p>
- * @return int
- */
- public synchronized int size()
- {
- return this.curSize;
- }
-
- /**
- * This determines the position in the array that is occupied by an object that is larger or
- * equal to the argument. If none exists, -1 is returned.
- * <p>
- * @param obj Object
- * @return Object
- */
- private int findNearestOccupiedLargerOrEqualPosition(T obj)
- {
- if ( curSize == 0 )
- {
- // nothing in the array
- return -1;
- }
-
- // this gives us an insert position.
- int pos = findNearestLargerEqualOrLastPosition( obj );
-
- // see if the previous will do to handle the empty insert spot position
- if ( pos == curSize )
- { // && curSize < maxSize ) {
- // pos will be > 0 if it equals curSize, we check for this above.
- if ( obj.compareTo(array[pos - 1] ) <= 0 )
- {
- pos = pos - 1;
- }
- else
- {
- pos = -1;
- }
- }
- else
- {
- // the find nearest, returns the last, since it is used by insertion.
- if ( obj.compareTo(array[pos] ) > 0 )
- {
- return -1;
- }
- }
-
- return pos;
- }
-
- /**
- * This method determines the position where an insert should take place for a given object.
- * With some additional checking, this can also be used to find an object matching or greater
- * than the argument.
- * <p>
- * If the array is not full and the current object is larger than all the rest the first open
- * slot at the end will be returned.
- * <p>
- * NOTE: If the object is larger than the largest and it is full, it will return the last position.
- * <p>
- * If the array is empty, the first spot is returned.
- * <p>
- * If the object is smaller than all the rests, the first position is returned. The caller must
- * decide what to do given the preference.
- * <p>
- * Returns the position of the object nearest to or equal to the larger object.
- * <p>
- * If you want to find the takePosition, you have to calculate it.
- * findNearestOccupiedLargerOrEqualPosition will calculate this for you.
- * <p>
- * @param obj Comparable
- * @return int
- */
- private int findNearestLargerEqualOrLastPosition(T obj)
- {
- // do nothing if a null was passed in
- if ( obj == null )
- {
- return -1;
- }
-
- // return the first spot if the array is empty
- if ( curSize <= 0 )
- {
- return 0;
- }
-
- // mark the numer to be returned, the greaterPos as unset
- int greaterPos = -1;
- // prepare for a binary search
- int curPos = ( curSize - 1 ) / 2;
- int prevPos = -1;
-
- try
- {
- // set the loop exit flag to false
- boolean done = false;
-
- // check the ends
- // return insert position 0 if obj is smaller
- // than the smallest. the caller can determine what to
- // do with this, depending on the preference setting
- if ( obj.compareTo( getSmallest() ) <= 0 )
- {
- // LESS THAN OR EQUAL TO SMALLEST
- if ( log.isDebugEnabled() )
- {
- log.debug( obj + " is smaller than or equal to " + getSmallest() );
- }
- greaterPos = 0;
- done = true;
- // return greaterPos;
- }
- else
- {
- // GREATER THAN SMALLEST
- if ( log.isDebugEnabled() )
- {
- log.debug( obj + " is bigger than " + getSmallest() );
- }
-
- // return the largest position if obj is larger
- // than the largest. the caller can determine what to
- // do with this, depending on the preference setting
- if ( obj.compareTo( getLargest() ) >= 0 )
- {
- if ( curSize == maxSize )
- {
- // there is no room left in the array, return the last
- // spot
- greaterPos = curSize - 1;
- done = true;
- }
- else
- {
- // there is room left in the array
- greaterPos = curSize;
- done = true;
- }
- }
- else
- {
- // the obj is less than or equal to the largest, so we know that the
- // last item is larger or equal
- greaterPos = curSize - 1;
- }
- }
-
- // /////////////////////////////////////////////////////////////////////
- // begin binary search for insertion spot
- while ( !done )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( "\n curPos = " + curPos + "; greaterPos = " + greaterPos + "; prevpos = " + prevPos );
- }
-
- // get out of loop if we have come to the end or passed it
- if ( curPos == prevPos || curPos >= curSize )
- {
- done = true;
- break;
- }
- else
-
- // EQUAL TO
- // object at current position is equal to the obj, use this,
- // TODO could avoid some shuffling if I found a lower pos.
- if (array[curPos].compareTo( obj ) == 0 )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( array[curPos] + " is equal to " + obj );
- }
- greaterPos = curPos;
- done = true;
- break;
- }
- else
-
- // GREATER THAN
- // array object at current position is greater than the obj, go
- // left
- if (array[curPos].compareTo( obj ) > 0 )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( array[curPos] + " is greater than " + obj );
- }
- // set the smallest greater equal to the current position
- greaterPos = curPos;
- // set the current position to
- // set the previous position to the current position
- // We could have an integer overflow, but this array could
- // never get that large.
- int newPos = Math.min( curPos, ( curPos + prevPos ) / 2 );
- prevPos = curPos;
- curPos = newPos;
- }
- else
-
- // LESS THAN
- // the object at the current position is smaller, go right
- if (array[curPos].compareTo( obj ) < 0 )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( array[curPos] + " is less than " + obj );
- }
- if ( ( greaterPos != -1 ) && greaterPos - curPos < 0 )
- {
- done = true;
- break; // return greaterPos;
- }
- else
- {
- int newPos = 0;
- if ( prevPos > curPos )
- {
- newPos = Math.min( ( curPos + prevPos ) / 2, curSize );
- }
- else if ( prevPos == -1 )
- {
- newPos = Math.min( ( curSize + curPos ) / 2, curSize );
- }
- prevPos = curPos;
- curPos = newPos;
- }
- }
- } // end while
- // /////////////////////////////////////////////////////////////////////
-
- if ( log.isDebugEnabled() )
- {
- log.debug( "Greater Position is [" + greaterPos + "]" + " array[greaterPos] [" + array[greaterPos]
- + "]" );
- }
- }
- catch ( Exception e )
- {
- log.error( "\n curPos = " + curPos + "; greaterPos = " + greaterPos + "; prevpos = " + prevPos + " "
- + this.dumpArray(), e );
- }
-
- return greaterPos;
- }
-
- /**
- * Removes the item from the array at the specified position. The remaining items to the right
- * are shifted left.
- * <p>
- * @param position int
- * @throw IndexOutOfBoundsException if position is out of range.
- */
- private void remove( int position )
- {
- if ( position >= curSize || position < 0 )
- {
- throw new IndexOutOfBoundsException( "position=" + position + " must be less than curSize=" + curSize );
- }
- curSize--;
-
- if ( position < curSize )
- {
- try
- {
- System.arraycopy( array, position + 1, array, position, ( curSize - position ) );
- }
- catch ( IndexOutOfBoundsException ibe )
- {
- // throw this, log details for debugging. This shouldn't happen.
- log.warn( "Caught index out of bounds exception. "
- + "called 'System.arraycopy( array, position + 1, array, position, (curSize - position) );' "
- + "array.lengh [" + array.length + "] position [" + position + "] curSize [" + curSize + "]" );
- throw ibe;
- }
- }
- }
-
- /**
- * Debugging method to return a human readable display of array data.
- * <p>
- * @return String representation of the contents.
- */
- protected synchronized String dumpArray()
- {
- StringBuilder buf = new StringBuilder();
- buf.append( "\n ---------------------------" );
- buf.append( "\n curSize = " + curSize );
- buf.append( "\n array.length = " + array.length );
- buf.append( "\n ---------------------------" );
- buf.append( "\n Dump:" );
- for ( int i = 0; i < curSize; i++ )
- {
- buf.append( "\n " + i + "=" + array[i] );
- }
- return buf.toString();
- }
-}
diff --git a/commons-jcs-core/src/test/conf/cacheB.ccf b/commons-jcs-core/src/test/conf/cacheB.ccf
index 69c46b9..4127e9b 100644
--- a/commons-jcs-core/src/test/conf/cacheB.ccf
+++ b/commons-jcs-core/src/test/conf/cacheB.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=RC
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000
@@ -103,7 +103,6 @@
jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000
jcs.auxiliary.DC.attributes.MaxKeySize=10000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
# Disk Cache Using a Pooled Event Queue -- this allows you
@@ -112,13 +111,12 @@
# adding more threads does not help.
# If you want to use a separate pool for each disk cache, either use
# the single model or define a different auxiliary for each region and use the Pooled.
-# SINGLE is best unless you ahve a huge # of regions.
+# SINGLE is best unless you have a huge # of regions.
jcs.auxiliary.DC2=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC2.attributes=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC2.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC2.attributes.MaxPurgatorySize=10000
jcs.auxiliary.DC2.attributes.MaxKeySize=10000
-jcs.auxiliary.DC2.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC2.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC2.attributes.EventQueueType=POOLED
jcs.auxiliary.DC2.attributes.EventQueuePoolName=disk_cache_event_queue
diff --git a/commons-jcs-core/src/test/conf/cacheD10A.ccf b/commons-jcs-core/src/test/conf/cacheD10A.ccf
index c7ac3d3..8e1969f 100644
--- a/commons-jcs-core/src/test/conf/cacheD10A.ccf
+++ b/commons-jcs-core/src/test/conf/cacheD10A.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC,RC
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000000
@@ -88,7 +88,6 @@
jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000000
jcs.auxiliary.DC.attributes.MaxKeySize=1000000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.ShutdownSpoolTimeLimit=60
@@ -98,13 +97,12 @@
# adding more threads does not help.
# If you want to use a separate pool for each disk cache, either use
# the single model or define a different auxiliary for each region and use the Pooled.
-# SINGLE is best unless you ahve a huge # of regions.
+# SINGLE is best unless you have a huge # of regions.
jcs.auxiliary.DC2=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC2.attributes=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC2.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC2.attributes.MaxPurgatorySize=10000
jcs.auxiliary.DC2.attributes.MaxKeySize=10000
-jcs.auxiliary.DC2.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC2.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC2.attributes.EventQueueType=POOLED
jcs.auxiliary.DC2.attributes.EventQueuePoolName=disk_cache_event_queue
diff --git a/commons-jcs-core/src/test/conf/cacheD10B.ccf b/commons-jcs-core/src/test/conf/cacheD10B.ccf
index 993ea38..020ebce 100644
--- a/commons-jcs-core/src/test/conf/cacheD10B.ccf
+++ b/commons-jcs-core/src/test/conf/cacheD10B.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC,RC
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000000
@@ -88,7 +88,6 @@
jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000000
jcs.auxiliary.DC.attributes.MaxKeySize=1000000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.ShutdownSpoolTimeLimit=60
@@ -98,13 +97,12 @@
# adding more threads does not help.
# If you want to use a separate pool for each disk cache, either use
# the single model or define a different auxiliary for each region and use the Pooled.
-# SINGLE is best unless you ahve a huge # of regions.
+# SINGLE is best unless you have a huge # of regions.
jcs.auxiliary.DC2=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC2.attributes=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC2.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC2.attributes.MaxPurgatorySize=10000
jcs.auxiliary.DC2.attributes.MaxKeySize=10000
-jcs.auxiliary.DC2.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC2.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC2.attributes.EventQueueType=POOLED
jcs.auxiliary.DC2.attributes.EventQueuePoolName=disk_cache_event_queue
diff --git a/commons-jcs-core/src/test/conf/cacheID.ccf b/commons-jcs-core/src/test/conf/cacheID.ccf
index 27744e0..5cd50e1 100644
--- a/commons-jcs-core/src/test/conf/cacheID.ccf
+++ b/commons-jcs-core/src/test/conf/cacheID.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=0
@@ -60,6 +60,5 @@
jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000000
jcs.auxiliary.DC.attributes.MaxKeySize=1000000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=50000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.ShutdownSpoolTimeLimit=60
diff --git a/commons-jcs-core/src/test/conf/cacheJG1.ccf b/commons-jcs-core/src/test/conf/cacheJG1.ccf
index a0f7538..d6f7baf 100644
--- a/commons-jcs-core/src/test/conf/cacheJG1.ccf
+++ b/commons-jcs-core/src/test/conf/cacheJG1.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=LJG
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=250000
@@ -60,7 +60,6 @@
jcs.auxiliary.DC.attributes.DiskPath=logs/rafJG1
jcs.auxiliary.DC.attributes.MaxPurgatorySize=100000
jcs.auxiliary.DC.attributes.MaxKeySize=500000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=50000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=-1
# Lateral JavaGroups Distribution
diff --git a/commons-jcs-core/src/test/conf/cacheJG2.ccf b/commons-jcs-core/src/test/conf/cacheJG2.ccf
index 4e350cb..8409ac5 100644
--- a/commons-jcs-core/src/test/conf/cacheJG2.ccf
+++ b/commons-jcs-core/src/test/conf/cacheJG2.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=LJG
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=250000
@@ -60,7 +60,6 @@
jcs.auxiliary.DC.attributes.DiskPath=logs/rafJG2
jcs.auxiliary.DC.attributes.MaxPurgatorySize=100000
jcs.auxiliary.DC.attributes.MaxKeySize=500000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=50000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=-1
# Lateral JavaGroups Distribution
diff --git a/commons-jcs-core/src/test/conf/cacheJG3.ccf b/commons-jcs-core/src/test/conf/cacheJG3.ccf
index ba4fc1b..806ae26 100644
--- a/commons-jcs-core/src/test/conf/cacheJG3.ccf
+++ b/commons-jcs-core/src/test/conf/cacheJG3.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC,LJG
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=250000
@@ -60,7 +60,6 @@
jcs.auxiliary.DC.attributes.DiskPath=logs/rafJG1
jcs.auxiliary.DC.attributes.MaxPurgatorySize=100000
jcs.auxiliary.DC.attributes.MaxKeySize=500000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=50000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=-1
# Lateral JavaGroups Distribution
diff --git a/commons-jcs-core/src/test/conf/cacheLMD1.ccf b/commons-jcs-core/src/test/conf/cacheLMD1.ccf
index 4198030..14d3128 100644
--- a/commons-jcs-core/src/test/conf/cacheLMD1.ccf
+++ b/commons-jcs-core/src/test/conf/cacheLMD1.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
# LEAD_PRICE_CACHE_NAME
jcs.region.LeadPrice=DC,LJG
jcs.region.LeadPrice.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
@@ -80,7 +80,6 @@
jcs.auxiliary.DC.attributes.DiskPath=log/raf
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000
jcs.auxiliary.DC.attributes.MaxKeySize=10000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
# Lateral JavaGroups Distribution
diff --git a/commons-jcs-core/src/test/conf/cacheNA.ccf b/commons-jcs-core/src/test/conf/cacheNA.ccf
index 84a829c..8993040 100644
--- a/commons-jcs-core/src/test/conf/cacheNA.ccf
+++ b/commons-jcs-core/src/test/conf/cacheNA.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC,RC
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=250000
@@ -60,7 +60,6 @@
jcs.auxiliary.DC.attributes.DiskPath=logs/rafNA
jcs.auxiliary.DC.attributes.MaxPurgatorySize=100000
jcs.auxiliary.DC.attributes.MaxKeySize=500000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=50000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=-1
# REMOTE SERVER RS1
diff --git a/commons-jcs-core/src/test/conf/cacheNA2.ccf b/commons-jcs-core/src/test/conf/cacheNA2.ccf
index cd587a6..505ba1b 100644
--- a/commons-jcs-core/src/test/conf/cacheNA2.ccf
+++ b/commons-jcs-core/src/test/conf/cacheNA2.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC,RC
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=250000
@@ -60,7 +60,6 @@
jcs.auxiliary.DC.attributes.DiskPath=logs/rafNA
jcs.auxiliary.DC.attributes.MaxPurgatorySize=100000
jcs.auxiliary.DC.attributes.MaxKeySize=500000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=50000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=-1
# REMOTE SERVER RS1
diff --git a/commons-jcs-core/src/test/conf/cacheNA3.ccf b/commons-jcs-core/src/test/conf/cacheNA3.ccf
index e3f10e7..e4ed2ec 100644
--- a/commons-jcs-core/src/test/conf/cacheNA3.ccf
+++ b/commons-jcs-core/src/test/conf/cacheNA3.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC,RC
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=250000
@@ -60,7 +60,6 @@
jcs.auxiliary.DC.attributes.DiskPath=logs/rafNA
jcs.auxiliary.DC.attributes.MaxPurgatorySize=100000
jcs.auxiliary.DC.attributes.MaxKeySize=500000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=50000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=-1
# REMOTE SERVER RS1
diff --git a/commons-jcs-core/src/test/conf/cacheNB.ccf b/commons-jcs-core/src/test/conf/cacheNB.ccf
index 80e2a21..f428a2e 100644
--- a/commons-jcs-core/src/test/conf/cacheNB.ccf
+++ b/commons-jcs-core/src/test/conf/cacheNB.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC,RC
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=250000
@@ -60,7 +60,6 @@
jcs.auxiliary.DC.attributes.DiskPath=logs/rafNB
jcs.auxiliary.DC.attributes.MaxPurgatorySize=100000
jcs.auxiliary.DC.attributes.MaxKeySize=500000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=50000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=-1
# REMOTE SERVER -- RS2
diff --git a/commons-jcs-core/src/test/conf/cacheRC.ccf b/commons-jcs-core/src/test/conf/cacheRC.ccf
index 9ef2135..a59c887 100644
--- a/commons-jcs-core/src/test/conf/cacheRC.ccf
+++ b/commons-jcs-core/src/test/conf/cacheRC.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC,RC
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000000
@@ -103,7 +103,6 @@
jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000000
jcs.auxiliary.DC.attributes.MaxKeySize=1000000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.ShutdownSpoolTimeLimit=60
@@ -113,13 +112,12 @@
# adding more threads does not help.
# If you want to use a separate pool for each disk cache, either use
# the single model or define a different auxiliary for each region and use the Pooled.
-# SINGLE is best unless you ahve a huge # of regions.
+# SINGLE is best unless you have a huge # of regions.
jcs.auxiliary.DC2=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC2.attributes=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC2.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC2.attributes.MaxPurgatorySize=10000
jcs.auxiliary.DC2.attributes.MaxKeySize=10000
-jcs.auxiliary.DC2.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC2.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC2.attributes.EventQueueType=POOLED
jcs.auxiliary.DC2.attributes.EventQueuePoolName=disk_cache_event_queue
diff --git a/commons-jcs-core/src/test/conf/cacheRCSimple.ccf b/commons-jcs-core/src/test/conf/cacheRCSimple.ccf
index a155345..14366f9 100644
--- a/commons-jcs-core/src/test/conf/cacheRCSimple.ccf
+++ b/commons-jcs-core/src/test/conf/cacheRCSimple.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=RC
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000000
@@ -74,7 +74,6 @@
jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000000
jcs.auxiliary.DC.attributes.MaxKeySize=1000000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.ShutdownSpoolTimeLimit=60
@@ -84,13 +83,12 @@
# adding more threads does not help.
# If you want to use a separate pool for each disk cache, either use
# the single model or define a different auxiliary for each region and use the Pooled.
-# SINGLE is best unless you ahve a huge # of regions.
+# SINGLE is best unless you have a huge # of regions.
jcs.auxiliary.DC2=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC2.attributes=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC2.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC2.attributes.MaxPurgatorySize=10000
jcs.auxiliary.DC2.attributes.MaxKeySize=10000
-jcs.auxiliary.DC2.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC2.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC2.attributes.EventQueueType=POOLED
jcs.auxiliary.DC2.attributes.EventQueuePoolName=disk_cache_event_queue
diff --git a/commons-jcs-core/src/test/conf/cacheRC_CEL.ccf b/commons-jcs-core/src/test/conf/cacheRC_CEL.ccf
index 9c06932..59b7913 100644
--- a/commons-jcs-core/src/test/conf/cacheRC_CEL.ccf
+++ b/commons-jcs-core/src/test/conf/cacheRC_CEL.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC,RC
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000000
@@ -88,7 +88,6 @@
jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000000
jcs.auxiliary.DC.attributes.MaxKeySize=1000000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.ShutdownSpoolTimeLimit=60
diff --git a/commons-jcs-core/src/test/conf/cacheTCP1.ccf b/commons-jcs-core/src/test/conf/cacheTCP1.ccf
index 3644f6c..5fbfc03 100644
--- a/commons-jcs-core/src/test/conf/cacheTCP1.ccf
+++ b/commons-jcs-core/src/test/conf/cacheTCP1.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=LTCP
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000
diff --git a/commons-jcs-core/src/test/conf/cacheTCP2.ccf b/commons-jcs-core/src/test/conf/cacheTCP2.ccf
index c40c44e..4f03854 100644
--- a/commons-jcs-core/src/test/conf/cacheTCP2.ccf
+++ b/commons-jcs-core/src/test/conf/cacheTCP2.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=LTCP
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000
diff --git a/commons-jcs-core/src/test/conf/cacheTCP3.ccf b/commons-jcs-core/src/test/conf/cacheTCP3.ccf
index 3b727eb..15a119d 100644
--- a/commons-jcs-core/src/test/conf/cacheTCP3.ccf
+++ b/commons-jcs-core/src/test/conf/cacheTCP3.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=LTCP
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000
diff --git a/commons-jcs-core/src/test/conf/cacheTCP4.ccf b/commons-jcs-core/src/test/conf/cacheTCP4.ccf
index c748c23..69c6c1c 100644
--- a/commons-jcs-core/src/test/conf/cacheTCP4.ccf
+++ b/commons-jcs-core/src/test/conf/cacheTCP4.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=LTCP
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000
diff --git a/commons-jcs-core/src/test/conf/remote.cacheRS1.ccf b/commons-jcs-core/src/test/conf/remote.cacheRS1.ccf
index d540726..6c525d6 100644
--- a/commons-jcs-core/src/test/conf/remote.cacheRS1.ccf
+++ b/commons-jcs-core/src/test/conf/remote.cacheRS1.ccf
@@ -46,7 +46,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC,RCluster
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=250000
@@ -71,7 +71,6 @@
jcs.auxiliary.DC.attributes.DiskPath=logs/rafRS1
jcs.auxiliary.DC.attributes.MaxPurgatorySize=100000
jcs.auxiliary.DC.attributes.MaxKeySize=500000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=50000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=-1
# RS2 SERVER to update for clustering
diff --git a/commons-jcs-core/src/test/conf/remote.cacheRS2.ccf b/commons-jcs-core/src/test/conf/remote.cacheRS2.ccf
index 7d2e99c..dd561c9 100644
--- a/commons-jcs-core/src/test/conf/remote.cacheRS2.ccf
+++ b/commons-jcs-core/src/test/conf/remote.cacheRS2.ccf
@@ -46,7 +46,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC,RCluster
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=250000
@@ -71,7 +71,6 @@
jcs.auxiliary.DC.attributes.DiskPath=logs/rafRS2
jcs.auxiliary.DC.attributes.MaxPurgatorySize=100000
jcs.auxiliary.DC.attributes.MaxKeySize=500000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=50000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=-1
# RS1 SERVER to update for clustering
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheCountUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheCountUnitTest.java
index 14d4d29..db9ae10 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheCountUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheCountUnitTest.java
@@ -38,7 +38,6 @@
{
IndexedDiskCacheAttributes cattr = getCacheAttributes();
cattr.setCacheName( "testRemoveItems" );
- cattr.setMaxRecycleBinSize( 2 );
cattr.setOptimizeAtRemoveCount( 7 );
cattr.setMaxKeySize( 5 );
cattr.setMaxPurgatorySize( 0 );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java
index d869d44..66975c6 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java
@@ -39,7 +39,6 @@
{
IndexedDiskCacheAttributes cattr = getCacheAttributes();
cattr.setCacheName( "testRemoveItems" );
- cattr.setMaxRecycleBinSize( 2 );
cattr.setOptimizeAtRemoveCount( 7 );
cattr.setMaxKeySize( 8); // 1kb DiskTestObject takes 1420 bytes, so 5*1420 = 7100, so to keep 5 ojbects, we need max key size of 8
cattr.setMaxPurgatorySize( 0 );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTestAbstract.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTestAbstract.java
index a12afcf..f6fc6df 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTestAbstract.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTestAbstract.java
@@ -24,8 +24,6 @@
import java.util.Map;
import java.util.Set;
-import junit.framework.TestCase;
-
import org.apache.commons.jcs.auxiliary.MockCacheEventLogger;
import org.apache.commons.jcs.auxiliary.disk.DiskTestObject;
import org.apache.commons.jcs.engine.CacheElement;
@@ -36,6 +34,8 @@
import org.apache.commons.jcs.engine.control.group.GroupId;
import org.apache.commons.jcs.utils.timing.SleepUtil;
+import junit.framework.TestCase;
+
/**
* Tests for common functionality.
* <p>
@@ -245,7 +245,6 @@
IndexedDiskCacheAttributes cattr = getCacheAttributes();
cattr.setCacheName("testRecyleBinSize");
cattr.setDiskPath("target/test-sandbox/UnitTest");
- cattr.setMaxRecycleBinSize(numberToInsert);
cattr.setOptimizeAtRemoveCount(numberToInsert);
cattr.setMaxKeySize(numberToInsert * 2);
cattr.setMaxPurgatorySize(numberToInsert);
@@ -291,7 +290,6 @@
IndexedDiskCacheAttributes cattr = getCacheAttributes();
cattr.setCacheName("testRecyleBinUsage");
cattr.setDiskPath("target/test-sandbox/UnitTest");
- cattr.setMaxRecycleBinSize(numberToInsert);
cattr.setOptimizeAtRemoveCount(numberToInsert);
cattr.setMaxKeySize(numberToInsert * 2);
cattr.setMaxPurgatorySize(numberToInsert);
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java
index a31126f..77df909 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java
@@ -1,5 +1,9 @@
package org.apache.commons.jcs.auxiliary.disk.indexed;
+import org.apache.commons.jcs.auxiliary.disk.DiskTestObject;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.utils.timing.SleepUtil;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,9 +24,6 @@
*/
import junit.framework.TestCase;
-import org.apache.commons.jcs.auxiliary.disk.DiskTestObject;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.utils.timing.SleepUtil;
/**
* Tests for the optimization routine.
@@ -42,12 +43,11 @@
{
// SETUP
int removeCount = 50;
-
+
IndexedDiskCacheAttributes cattr = new IndexedDiskCacheAttributes();
cattr.setCacheName( "testOptimization" );
cattr.setMaxKeySize( removeCount * 2 );
cattr.setOptimizeAtRemoveCount( removeCount );
- cattr.setMaxRecycleBinSize( removeCount * 3 );
cattr.setDiskPath( "target/test-sandbox/testOptimization" );
IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<Integer, DiskTestObject>( cattr );
@@ -61,7 +61,7 @@
{
disk.processUpdate( elements[i] );
}
-
+
Thread.sleep( 1000 );
long sizeBeforeRemove = disk.getDataFileSize();
@@ -73,7 +73,7 @@
{
disk.processRemove( Integer.valueOf( i ) );
}
-
+
SleepUtil.sleepAtLeast( 1000 );
disk.optimizeFile();
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/SingleLinkedListUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/SingleLinkedListUnitTest.java
deleted file mode 100644
index e18bf16..0000000
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/SingleLinkedListUnitTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.apache.commons.jcs.utils.struct;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import junit.framework.TestCase;
-
-/**
- * Tests for the simple linked list.
- * <p>
- * @author Aaron Smuts
- */
-public class SingleLinkedListUnitTest
- extends TestCase
-{
- /**
- * Verify that we get a null and that there are no exceptions.
- */
- public void testTakeFromEmptyList()
- {
- // SETUP
- SingleLinkedList<Object> list = new SingleLinkedList<Object>();
-
- // DO WORK
- Object result = list.takeFirst();
-
- // VERIFY
- assertNull( "Shouldn't have anything.", result );
- }
-
- /**
- * Verify FIFO behavior. Verifies that all items are removed.
- */
- public void testAddABunchAndTakeFromList()
- {
- // SETUP
- SingleLinkedList<Integer> list = new SingleLinkedList<Integer>();
-
- // DO WORK
- int numToPut = 100;
- for ( int i = 0; i < numToPut; i++ )
- {
- list.addLast( Integer.valueOf( i ) );
- }
-
- // VERIFY
- assertEquals( "Wrong number in list.", numToPut, list.size() );
-
- for ( int i = 0; i < numToPut; i++ )
- {
- Integer result = list.takeFirst();
- assertEquals( "Wrong value returned.", Integer.valueOf( i ), result );
- }
-
- // DO WORK
- Integer result = list.takeFirst();
-
- // VERIFY
- assertNull( "Shouldn't have anything left.", result );
- }
-
- /**
- * Verify that after calling clear all items are removed adn the size is 0.
- */
- public void testAddABunchAndClear()
- {
- // SETUP
- SingleLinkedList<Integer> list = new SingleLinkedList<Integer>();
-
- // DO WORK
- int numToPut = 100;
- for ( int i = 0; i < numToPut; i++ )
- {
- list.addLast( Integer.valueOf( i ) );
- }
-
- // VERIFY
- assertEquals( "Wrong number in list.", numToPut, list.size() );
-
- // DO WORK
- list.clear();
- Integer result = list.takeFirst();
-
- // VERIFY
- assertEquals( "Wrong number in list.", 0, list.size() );
- assertNull( "Shouldn't have anything left.", result );
- }
-}
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java
deleted file mode 100644
index 3dc32c4..0000000
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java
+++ /dev/null
@@ -1,454 +0,0 @@
-package org.apache.commons.jcs.utils.struct;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import junit.framework.TestCase;
-
-/**
- * Tests the SortedPrefArray used by the recycle bin.
- * @author aaronsm
- */
-public class SortedPrefArrayUnitTest
- extends TestCase
-{
-
- /**
- * Constructor for the TestSimpleLoad object
- * @param testName Description of the Parameter
- */
- public SortedPrefArrayUnitTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @throws Exception
- */
- public void testLargePref()
- throws Exception
- {
- int maxSize = 25;
-
- SortedPreferentialArray<String> array = new SortedPreferentialArray<String>( maxSize );
- // array.setPreferLarge( false );
- array.setPreferLarge( true );
- String[] elem = {
- "10",
- "11",
- "01",
- "02",
- "03",
- "04",
- "05",
- "08",
- "07",
- "06",
- "09",
- "12",
- "13",
- "15",
- "14",
- "20",
- "25",
- "29",
- "28",
- "16",
- "17",
- "96",
- "00",
- "72",
- "39",
- "55",
- "44",
- "26",
- "22",
- "59",
- "38",
- "16",
- "27" };
-
- // put more than the max in a random order
- for ( int i = 0; i < elem.length; i++ )
- {
- array.add( elem[i] );
- // System.out.println( array.dumpArray() );
- }
-
- assertEquals( "Size was not as expected.", maxSize, array.size() );
-
- // this is a fragile test, since it relies on a hardcoded array
- String smallest = array.getSmallest();
- assertEquals( "smallest should be 08", "08", smallest );
-
- String largest = array.getLargest();
- assertEquals( "Largest should be 96", "96", largest );
-
- // this should take 96;
- String taken = array.takeNearestLargerOrEqual( "95" );
- assertEquals( "Taken should be 96", "96", taken );
- assertEquals( "Size was not as expected.", ( maxSize - 1 ), array.size() );
-
- // System.out.println( array.dumpArray() );
- }
-
- /**
- * Verify that we don't get an error when taking from an empty array.
- * @throws Exception
- */
- public void testEmptyTake()
- throws Exception
- {
- int maxSize = 25;
- SortedPreferentialArray<String> array = new SortedPreferentialArray<String>( maxSize );
- array.setPreferLarge( true );
- for ( int i = 0; i < maxSize; i++ )
- {
- String taken = array.takeNearestLargerOrEqual( String.valueOf( i ) );
- assertNull( "taken should be null, since nothing was in the array", taken );
- }
- }
-
- /**
- * Verify that we don't get a null pointer if we insert a null.
- * @throws Exception
- */
- public void testNullInsertion()
- throws Exception
- {
- int maxSize = 25;
- SortedPreferentialArray<String> array = new SortedPreferentialArray<String>( maxSize );
- array.setPreferLarge( true );
-
- String[] elem = {
- "10",
- "11",
- "01",
- "02",
- "03",
- "04",
- "05",
- "08",
- "07",
- "06",
- "09",
- "12",
- "13",
- "15",
- "14",
- "20",
- "25",
- "29",
- "28",
- "16",
- "17",
- "96",
- "00",
- "72",
- "39",
- "55",
- "44",
- "26",
- "22",
- "59",
- "38",
- "16",
- "27" };
-
- // put more than the max in a random order
- for ( int i = 0; i < elem.length; i++ )
- {
- array.add( elem[i] );
- }
- // System.out.println( array.dumpArray() );
-
- assertEquals( "Size was not as expected.", maxSize, array.size() );
-
- try
- {
- // should not get an error
- array.add( null );
- }
- catch ( NullPointerException e )
- {
- fail( "Got a null pointer inserting a null" );
- }
-
- }
-
- /**
- * Verify that we don't get an npe when taking with a null
- * @throws Exception
- */
- public void testNullTake()
- throws Exception
- {
- int maxSize = 25;
- SortedPreferentialArray<String> array = new SortedPreferentialArray<String>( maxSize );
- array.setPreferLarge( true );
-
- try
- {
- String taken = array.takeNearestLargerOrEqual( null );
- assertNull( "taken should be null, since nothing was in the array", taken );
- }
- catch ( NullPointerException e )
- {
- fail( "Got a null pointer trying to take with a null" );
- }
- }
-
- /**
- * Verify that we don't get an npe when taking from an array of only one
- * @throws Exception
- */
- public void testSingleItemTake()
- throws Exception
- {
- int maxSize = 25;
- SortedPreferentialArray<String> array = new SortedPreferentialArray<String>( maxSize );
- array.setPreferLarge( true );
-
- array.add( "10" );
- // System.out.println( array.dumpArray() );
-
- try
- {
- String taken = array.takeNearestLargerOrEqual( "09" );
- // System.out.println( taken );
- assertNotNull( "taken should not be null, since nothing was in the array", taken );
- }
- catch ( NullPointerException e )
- {
- fail( "Got a null pointer trying to take with a null" );
- }
- }
-
- /**
- * Verify that we don't get an npe when taking from an array of only one
- * @throws Exception
- */
- public void testSingleItemTakeLarger()
- throws Exception
- {
- int maxSize = 25;
- SortedPreferentialArray<String> array = new SortedPreferentialArray<String>( maxSize );
- array.setPreferLarge( true );
-
- array.add( "10" );
-
- try
- {
- String taken = array.takeNearestLargerOrEqual( "11" );
- assertNull( "taken should be null, since nothing smaller was in the array", taken );
- }
- catch ( NullPointerException e )
- {
- fail( "Got a null pointer trying to take with a null" );
- }
- }
-
- /**
- * Verify that we don't get an npe when taking from an array of none
- * @throws Exception
- */
- public void testSingleItemTakeLargerEmpty()
- throws Exception
- {
- int maxSize = 25;
- SortedPreferentialArray<String> array = new SortedPreferentialArray<String>( maxSize );
- array.setPreferLarge( true );
-
- try
- {
- String taken = array.takeNearestLargerOrEqual( "11" );
- assertNull( "taken should be null, since nothing was in the array", taken );
- }
- catch ( NullPointerException e )
- {
- fail( "Got a null pointer trying to take with a null" );
- }
- }
-
- /**
- * Test taking the largest item.
- * @throws Exception
- */
- public void testTakeLargestItem()
- throws Exception
- {
- int maxSize = 9;
-
- SortedPreferentialArray<String> array = new SortedPreferentialArray<String>( maxSize );
- // array.setPreferLarge( false );
- array.setPreferLarge( true );
- String[] elem = { "01", "02", "03", "04", "05", "08", "07", "06", "09", };
-
- // put more than the max in a random order
- for ( int i = 0; i < elem.length; i++ )
- {
- array.add( elem[i] );
- // System.out.println( array.dumpArray() );
- }
-
- assertEquals( "Size was not as expected.", maxSize, array.size() );
-
- // this is a fragile test, since it relies on a hardcoded array
- String smallest = array.getSmallest();
- assertEquals( "smallest is not as expected", "01", smallest );
-
- String largest = array.getLargest();
- assertEquals( "Largest is not as expected", "09", largest );
-
- // this should take 96;
- String taken = array.takeNearestLargerOrEqual( "09" );
- assertEquals( "Taken is not as expected", "09", taken );
- assertEquals( "Size was not as expected.", ( maxSize - 1 ), array.size() );
-
- // System.out.println( "testTakeLastItem" + array.dumpArray() );
- }
-
- /**
- * Test taking every last item.
- * <p>
- * @throws Exception
- */
- public void testTakeEveryLastItem()
- throws Exception
- {
- int maxSize = 9;
-
- SortedPreferentialArray<String> array = new SortedPreferentialArray<String>( maxSize );
- // array.setPreferLarge( false );
- array.setPreferLarge( true );
- String[] elem = { "01", "02", "03", "04", "05", "08", "07", "06", "09", };
-
- // put more than the max in a random order
- for ( int i = 0; i < elem.length; i++ )
- {
- array.add( elem[i] );
- // System.out.println( array.dumpArray() );
- }
-
- assertEquals( "Size was not as expected.", maxSize, array.size() );
-
- // this is a fragile test, since it relies on a hardcoded array
- String smallest = array.getSmallest();
- assertEquals( "smallest is not as expected", "01", smallest );
-
- String largest = array.getLargest();
- assertEquals( "Largest is not as expected", "09", largest );
-
- // this should take 96;
- String taken = array.takeNearestLargerOrEqual( "09" );
- assertEquals( "Taken is not as expected", "09", taken );
- assertEquals( "Size was not as expected. " + array.dumpArray(), ( maxSize - 1 ), array.size() );
-
- // System.out.println( "testTakeEveryLastItem" + array.dumpArray() );
-
- // take the rest
- // take more than the max in a reverse order
- for ( int i = elem.length - 1; i >= 0; i-- )
- {
- array.takeNearestLargerOrEqual( elem[i] );
- }
- // System.out.println( "testTakeEveryLastItem" + array.dumpArray() );
-
- assertEquals( "There should nothing left. " + array.dumpArray(), 0, array.size() );
- }
-
- /**
- * Try taking an item larger than the greatest.
- */
- public void testTakeLargerThanGreatest()
- {
- int maxSize = 3;
-
- SortedPreferentialArray<String> array = new SortedPreferentialArray<String>( maxSize );
- // array.setPreferLarge( false );
- array.setPreferLarge( true );
- String[] elem = { "01", "02", "03" };
-
- // put more than the max in a random order
- for ( int i = 0; i < elem.length; i++ )
- {
- array.add( elem[i] );
- // System.out.println( array.dumpArray() );
- }
-
- // DO WORK
- Comparable<String> taken = array.takeNearestLargerOrEqual( "04" );
-// System.out.println( "testTakeLargerThanGreatest" + array.dumpArray() );
-
- assertNull( "We should have nothing since the largest element was smaller than what we asked for. "
- + " Instead we got " + taken, taken );
- }
-
- /**
- * Try taking an item equal to the greatest. Make the last two the same size
- */
- public void testEqualToGreatest_LastTwoSameSize()
- {
- int maxSize = 3;
-
- SortedPreferentialArray<String> array = new SortedPreferentialArray<String>( maxSize );
- // array.setPreferLarge( false );
- array.setPreferLarge( true );
- String[] elem = { "01", "02", "03", "03" };
-
- // put more than the max in a random order
- for ( int i = 0; i < elem.length; i++ )
- {
- array.add( elem[i] );
- // System.out.println( array.dumpArray() );
- }
-
- // DO WORK
- Comparable<String> taken = array.takeNearestLargerOrEqual( "03" );
- // System.out.println( "testEqualToGreatest_LastTwoSameSize" + array.dumpArray() );
-
- assertNotNull( "We should have something since the largest element was equal to what we asked for.", taken );
- }
-
- /**
- * Try taking an item equal to the greatest. The second to last should be smaller. This verifies the most basic funtionality.
- */
- public void testEqualToGreatest()
- {
- int maxSize = 3;
-
- SortedPreferentialArray<String> array = new SortedPreferentialArray<String>( maxSize );
- // array.setPreferLarge( false );
- array.setPreferLarge( true );
- String[] elem = { "01", "02", "03" };
-
- // put more than the max in a random order
- for ( int i = 0; i < elem.length; i++ )
- {
- array.add( elem[i] );
- // System.out.println( array.dumpArray() );
- }
-
- // DO WORK
- Comparable<String> taken = array.takeNearestLargerOrEqual( "03" );
- // System.out.println( "testEqualToGreatest" + array.dumpArray() );
-
- assertNotNull( "We should have something since the largest element was equal to what we asked for.", taken );
- }
-}
diff --git a/commons-jcs-core/src/test/test-conf/TestDiskCacheCon.ccf b/commons-jcs-core/src/test/test-conf/TestDiskCacheCon.ccf
index 63ba766..e9b32e6 100644
--- a/commons-jcs-core/src/test/test-conf/TestDiskCacheCon.ccf
+++ b/commons-jcs-core/src/test/test-conf/TestDiskCacheCon.ccf
@@ -55,7 +55,6 @@
jcs.auxiliary.indexedDiskCache.attributes.DiskPath=target/test-sandbox/indexed-disk-cache-conc
jcs.auxiliary.indexedDiskCache.attributes.MaxPurgatorySize=10000
jcs.auxiliary.indexedDiskCache.attributes.MaxKeySize=10000
-jcs.auxiliary.indexedDiskCache.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.indexedDiskCache.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.indexedDiskCache.attributes.EventQueueType=SINGLE
jcs.auxiliary.indexedDiskCache.attributes.EventQueuePoolName=disk_cache_event_queue
diff --git a/commons-jcs-core/src/test/test-conf/TestDiskCacheDefragPerformance.ccf b/commons-jcs-core/src/test/test-conf/TestDiskCacheDefragPerformance.ccf
index 7ff2c7d..dd6b7a6 100644
--- a/commons-jcs-core/src/test/test-conf/TestDiskCacheDefragPerformance.ccf
+++ b/commons-jcs-core/src/test/test-conf/TestDiskCacheDefragPerformance.ccf
@@ -30,5 +30,4 @@
jcs.auxiliary.DC.attributes.maxKeySize=10000
jcs.auxiliary.DC.attributes.MaxPurgatorySize=5000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=5000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=5000
diff --git a/commons-jcs-core/src/test/test-conf/TestDiskCacheHuge.ccf b/commons-jcs-core/src/test/test-conf/TestDiskCacheHuge.ccf
index f8b14f5..a835210 100644
--- a/commons-jcs-core/src/test/test-conf/TestDiskCacheHuge.ccf
+++ b/commons-jcs-core/src/test/test-conf/TestDiskCacheHuge.ccf
@@ -39,7 +39,6 @@
jcs.auxiliary.indexedDiskCache.attributes.DiskPath=target/test-sandbox/indexed-disk-cache-conc
jcs.auxiliary.indexedDiskCache.attributes.MaxPurgatorySize=300000
jcs.auxiliary.indexedDiskCache.attributes.MaxKeySize=500000
-jcs.auxiliary.indexedDiskCache.attributes.MaxRecycleBinSize=50000
jcs.auxiliary.indexedDiskCache.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.indexedDiskCache.attributes.EventQueueType=SINGLE
# jcs.auxiliary.indexedDiskCache.attributes.EventQueuePoolName=disk_cache_event_queue
diff --git a/commons-jcs-core/src/test/test-conf/TestDiskCacheSteadyLoad.ccf b/commons-jcs-core/src/test/test-conf/TestDiskCacheSteadyLoad.ccf
index e25bdef..0b5d3ba 100644
--- a/commons-jcs-core/src/test/test-conf/TestDiskCacheSteadyLoad.ccf
+++ b/commons-jcs-core/src/test/test-conf/TestDiskCacheSteadyLoad.ccf
@@ -31,4 +31,3 @@
jcs.auxiliary.DC.attributes.maxKeySize=1000
jcs.auxiliary.DC.attributes.MaxPurgatorySize=1000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=20000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=10000
diff --git a/commons-jcs-core/src/test/test-conf/TestDiskCacheUsagePattern.ccf b/commons-jcs-core/src/test/test-conf/TestDiskCacheUsagePattern.ccf
index 61db76e..5f718ae 100644
--- a/commons-jcs-core/src/test/test-conf/TestDiskCacheUsagePattern.ccf
+++ b/commons-jcs-core/src/test/test-conf/TestDiskCacheUsagePattern.ccf
@@ -44,7 +44,6 @@
jcs.auxiliary.indexedDiskCache.attributes.DiskPath=target/test-sandbox/indexed-disk-cache-conc
jcs.auxiliary.indexedDiskCache.attributes.MaxPurgatorySize=10000
jcs.auxiliary.indexedDiskCache.attributes.MaxKeySize=10000
-jcs.auxiliary.indexedDiskCache.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.indexedDiskCache.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.indexedDiskCache.attributes.EventQueueType=SINGLE
jcs.auxiliary.indexedDiskCache.attributes.EventQueuePoolName=disk_cache_event_queue
diff --git a/commons-jcs-core/src/test/test-conf/TestJCS-73.ccf b/commons-jcs-core/src/test/test-conf/TestJCS-73.ccf
index ddfe439..c6220bf 100644
--- a/commons-jcs-core/src/test/test-conf/TestJCS-73.ccf
+++ b/commons-jcs-core/src/test/test-conf/TestJCS-73.ccf
@@ -35,7 +35,6 @@
jcs.auxiliary.CACHE.attributes.DiskPath=target/test-sandbox/concurrent_cache
jcs.auxiliary.CACHE.attributes.MaxPurgatorySize=-1
jcs.auxiliary.CACHE.attributes.MaxKeySize=-1
-jcs.auxiliary.CACHE.attributes.MaxRecycleBinSize=500
jcs.auxiliary.CACHE.attributes.ShutdownSpoolTimeLimit=60
jcs.auxiliary.CACHE.attributes.OptimizeAtRemoveCount=30000
jcs.auxiliary.CACHE.attributes.OptimizeOnShutdown=true
diff --git a/commons-jcs-core/src/test/test-conf/TestUDPDiscovery.ccf b/commons-jcs-core/src/test/test-conf/TestUDPDiscovery.ccf
index 742c237..34b7253 100644
--- a/commons-jcs-core/src/test/test-conf/TestUDPDiscovery.ccf
+++ b/commons-jcs-core/src/test/test-conf/TestUDPDiscovery.ccf
@@ -35,7 +35,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=LTCP
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000
diff --git a/commons-jcs-core/src/test/test-conf/cache2.ccf b/commons-jcs-core/src/test/test-conf/cache2.ccf
index 16133ed..c263515 100644
--- a/commons-jcs-core/src/test/test-conf/cache2.ccf
+++ b/commons-jcs-core/src/test/test-conf/cache2.ccf
@@ -49,7 +49,7 @@
# #############################################################
# ################# CACHE REGIONS AVAILABLE ###################
-# Regions preconfirgured for caching
+# Regions preconfigured for caching
jcs.region.testCache1=DC,RC
jcs.region.testCache1.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000
diff --git a/pom.xml b/pom.xml
index 38863f1..9e28f67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -254,57 +254,6 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-test-jar</id>
- <phase>package</phase>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <skipIfEmpty>true</skipIfEmpty>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <executions>
- <execution>
- <id>create-javadoc-jar</id>
- <goals>
- <goal>javadoc</goal>
- <goal>jar</goal>
- </goals>
- <phase>package</phase>
- </execution>
- </executions>
- <configuration>
- <source>${maven.compiler.source}</source>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- <execution>
- <id>attach-test-sources</id>
- <goals>
- <goal>test-jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<!-- Disable Apache Parent POM built-in source assembly -->
<executions>
@@ -314,6 +263,12 @@
<skipAssembly>true</skipAssembly>
</configuration>
</execution>
+ <execution>
+ <id>default</id>
+ <configuration>
+ <skipAssembly>true</skipAssembly>
+ </configuration>
+ </execution>
</executions>
</plugin>
</plugins>
@@ -534,7 +489,7 @@
<plugin>
<artifactId>maven-release-plugin</artifactId>
<configuration>
- <autoVersionSubmodules>true</autoVersionSubmodules>
+ <releaseProfiles>release,apache-release</releaseProfiles>
</configuration>
</plugin>
</plugins>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 8ad5ab4..534cf5a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -21,7 +21,16 @@
<body>
<release version="2.0" date="unreleased" description="JDK 1.6 based major release">
</release>
- <release version="2.0-beta-2" date="2016-10-10" description="JDK 1.6 based major release (beta-2)">
+ <release version="2.0-beta-2" date="2016-10-21" description="JDK 1.6 based major release (beta-2)">
+ <action dev="tv" type="remove">
+ Remove size limitation configuration of indexed cache recycle bin
+ </action>
+ <action dev="tv" type="remove">
+ Replace SortedPreferentialArray with JDK ConcurrentSkipListSet
+ </action>
+ <action dev="tv" type="remove">
+ Replace SingleLinkedList with JDK ConcurrentLinkedQueue
+ </action>
<action issue="JCS-130" dev="tv" type="update">
Simplify management of auxiliary caches
</action>
diff --git a/xdocs/IndexedDiskAuxCache.xml b/xdocs/IndexedDiskAuxCache.xml
index beb0480..9842219 100644
--- a/xdocs/IndexedDiskAuxCache.xml
+++ b/xdocs/IndexedDiskAuxCache.xml
@@ -56,10 +56,9 @@
<p>
When items are removed from the disk cache, the
location of the available block on the storage file
- is recorded in a sorted preferential array of a size
- not to exceed the maximum number of keys allowed in
- memory. This allows the disk cache to reuse empty
- spots, thereby keeping the file size to a minimum.
+ is recorded in skip list set. This allows the disk
+ cache to reuse empty spots, thereby keeping the file
+ size to a minimum.
</p>
</subsection>
@@ -159,13 +158,8 @@
Slots in the data file become empty when items are
removed from the disk cache. The indexed disk cache
keeps track of empty slots in the data file, so they
- can be reused. The slot locations are stored in a
- sorted preferential array -- the recycle bin. The
- smallest items are removed from the recycle bin when
- it reaches the specified limit. The
- MaxRecycleBinSize cannot be larger than the
- MaxKeySize. If the MaxKeySize is less than 0, the
- recycle bin will default to 5000.
+ can be reused. The slot locations are stored in the
+ recycle bin.
</p>
<p>
If all the items put on disk are the same size, then
@@ -177,11 +171,6 @@
written to disk, unusable gaps will result.
Optimization is intended to remove these gaps.
</p>
- <source>
- <![CDATA[
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=10000
- ]]>
- </source>
<p>
The Disk cache can be configured to defragment the
data file at runtime. Since defragmentation is only
@@ -240,7 +229,6 @@
jcs.auxiliary.DC.attributes.MaxKeySize=10000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.OptimizeOnShutdown=true
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=7500
jcs.auxiliary.DC.attributes.DiskLimitType=COUNT
]]>
</source>
@@ -299,7 +287,6 @@
jcs.auxiliary.DC2.attributes.DiskPath=target/test-sandbox/raf
jcs.auxiliary.DC2.attributes.MaxPurgatorySize=10000
jcs.auxiliary.DC2.attributes.MaxKeySize=10000
-jcs.auxiliary.DC2.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC2.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.OptimizeOnShutdown=true
jcs.auxiliary.DC2.attributes.EventQueueType=POOLED
diff --git a/xdocs/IndexedDiskCacheProperties.xml b/xdocs/IndexedDiskCacheProperties.xml
index a6de811..125882e 100644
--- a/xdocs/IndexedDiskCacheProperties.xml
+++ b/xdocs/IndexedDiskCacheProperties.xml
@@ -79,15 +79,6 @@
<td>N</td>
<td>false</td>
</tr>
- <tr>
- <td>MaxRecycleBinSize</td>
- <td> The maximum number of empty spots the cache will keep track
- of. The smallest are removed when the maximum size is reached.
- Keeping track of empty spots on disk allows us to reuse spots,
- thereby keeping the file from growing unncessarily.</td>
- <td>N</td>
- <td>5000</td>
- </tr>
</table>
</subsection>
<subsection name="Example Configuration">
@@ -101,7 +92,6 @@
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.OptimizeOnShutdown=true
jcs.auxiliary.DC.attributes.ClearDiskOnStartup=false
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=7500
]]>
</source>
</subsection>
@@ -147,7 +137,6 @@
jcs.auxiliary.DC.attributes.MaxKeySize=10000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.OptimizeOnShutdown=true
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=7500
jcs.auxiliary.DC.attributes.EventQueueType=POOLED
jcs.auxiliary.DC.attributes.EventQueuePoolName=disk_cache_event_queue
diff --git a/xdocs/UsingJCSBasicWeb.xml b/xdocs/UsingJCSBasicWeb.xml
index ee48112..b54f6d8 100644
--- a/xdocs/UsingJCSBasicWeb.xml
+++ b/xdocs/UsingJCSBasicWeb.xml
@@ -406,7 +406,6 @@
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000
jcs.auxiliary.DC.attributes.MaxKeySize=10000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=7500
# Remote RMI Cache set up to failover
jcs.auxiliary.RFailover=
diff --git a/xdocs/getting_started/intro.xml b/xdocs/getting_started/intro.xml
index 6e74e4f..c13fa4b 100644
--- a/xdocs/getting_started/intro.xml
+++ b/xdocs/getting_started/intro.xml
@@ -183,7 +183,6 @@
jcs.auxiliary.DC.attributes.DiskPath=${user.dir}/jcs_swap
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000000
jcs.auxiliary.DC.attributes.MaxKeySize=1000000
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=5000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.ShutdownSpoolTimeLimit=60
]]>