You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by tv...@apache.org on 2007/05/10 18:04:27 UTC
svn commit: r536904 [35/38] - in /jakarta/jcs/trunk: ./
auxiliary-builds/javagroups/
auxiliary-builds/javagroups/src/java/org/apache/jcs/auxiliary/javagroups/
auxiliary-builds/javagroups/src/test/org/apache/jcs/auxiliary/javagroups/
auxiliary-builds/jd...
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapUnitTest.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapUnitTest.java Thu May 10 09:03:42 2007
@@ -1,118 +1,137 @@
-package org.apache.jcs.utils.struct;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import org.apache.jcs.utils.struct.LRUMap;
-
-import junit.framework.TestCase;
-
-/**
- * Basic unit tests for the LRUMap
- *
- * @author Aaron Smuts
- *
- */
-public class LRUMapUnitTest
- extends TestCase
-{
-
- /**
- * Put up to the size limit and then make sure they are all there.
- *
- */
- public void testPutWithSizeLimit()
- {
- int size = 10;
- Map cache = new LRUMap( size );
-
- for ( int i = 0; i < size; i++ )
- {
- cache.put( "key:" + i, "data:" + i );
- }
-
- for ( int i = 0; i < size; i++ )
- {
- String data = (String)cache.get( "key:" + i );
- assertEquals( "Data is wrong.", "data:" + i, data );
- }
- }
-
- /**
- * Put into the lru with no limit and then make sure they are all there.
- *
- */
- public void testPutWithNoSizeLimit()
- {
- int size = 10;
- Map cache = new LRUMap( );
-
- for ( int i = 0; i < size; i++ )
- {
- cache.put( "key:" + i, "data:" + i );
- }
-
- for ( int i = 0; i < size; i++ )
- {
- String data = (String)cache.get( "key:" + i );
- assertEquals( "Data is wrong.", "data:" + i, data );
- }
- }
-
- /**
- * Put and then remove. Make sure the element is returned.
- *
- */
- public void testPutAndRemove()
- {
- int size = 10;
- Map cache = new LRUMap( size );
-
- cache.put( "key:" + 1, "data:" + 1 );
- String data = (String)cache.remove( "key:" + 1 );
- assertEquals( "Data is wrong.", "data:" + 1, data );
- }
-
- /**
- * Call remove on an empty map
- *
- */
- public void testRemoveEmpty()
- {
- int size = 10;
- Map cache = new LRUMap( size );
-
- Object returned = cache.remove( "key:" + 1 );
- assertNull( "Shouldn't hvae anything.", returned );
- }
-
-
- /**
- * Add items to the map and then test to see that they come back in the entry set.
- *
- */
- public void testGetEntrySet()
- {
- int size = 10;
- Map cache = new LRUMap( size );
-
- for ( int i = 0; i < size; i++ )
- {
- cache.put( "key:" + i, "data:" + i );
- }
-
- Set entries = cache.entrySet();
- assertEquals( "Set contains the wrong number of items.", size, entries.size() );
-
- // check minimal correctness
- Object[] entryArray = entries.toArray();
- for ( int i = 0; i < size; i++ )
- {
- Entry data = (Entry)entryArray[i];
- assertTrue( "Data is wrong.", data.getValue().toString().indexOf( "data:") != -1 );
- }
- }
-
-
-}
+package org.apache.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 java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import org.apache.jcs.utils.struct.LRUMap;
+
+import junit.framework.TestCase;
+
+/**
+ * Basic unit tests for the LRUMap
+ *
+ * @author Aaron Smuts
+ *
+ */
+public class LRUMapUnitTest
+ extends TestCase
+{
+
+ /**
+ * Put up to the size limit and then make sure they are all there.
+ *
+ */
+ public void testPutWithSizeLimit()
+ {
+ int size = 10;
+ Map cache = new LRUMap( size );
+
+ for ( int i = 0; i < size; i++ )
+ {
+ cache.put( "key:" + i, "data:" + i );
+ }
+
+ for ( int i = 0; i < size; i++ )
+ {
+ String data = (String)cache.get( "key:" + i );
+ assertEquals( "Data is wrong.", "data:" + i, data );
+ }
+ }
+
+ /**
+ * Put into the lru with no limit and then make sure they are all there.
+ *
+ */
+ public void testPutWithNoSizeLimit()
+ {
+ int size = 10;
+ Map cache = new LRUMap( );
+
+ for ( int i = 0; i < size; i++ )
+ {
+ cache.put( "key:" + i, "data:" + i );
+ }
+
+ for ( int i = 0; i < size; i++ )
+ {
+ String data = (String)cache.get( "key:" + i );
+ assertEquals( "Data is wrong.", "data:" + i, data );
+ }
+ }
+
+ /**
+ * Put and then remove. Make sure the element is returned.
+ *
+ */
+ public void testPutAndRemove()
+ {
+ int size = 10;
+ Map cache = new LRUMap( size );
+
+ cache.put( "key:" + 1, "data:" + 1 );
+ String data = (String)cache.remove( "key:" + 1 );
+ assertEquals( "Data is wrong.", "data:" + 1, data );
+ }
+
+ /**
+ * Call remove on an empty map
+ *
+ */
+ public void testRemoveEmpty()
+ {
+ int size = 10;
+ Map cache = new LRUMap( size );
+
+ Object returned = cache.remove( "key:" + 1 );
+ assertNull( "Shouldn't hvae anything.", returned );
+ }
+
+
+ /**
+ * Add items to the map and then test to see that they come back in the entry set.
+ *
+ */
+ public void testGetEntrySet()
+ {
+ int size = 10;
+ Map cache = new LRUMap( size );
+
+ for ( int i = 0; i < size; i++ )
+ {
+ cache.put( "key:" + i, "data:" + i );
+ }
+
+ Set entries = cache.entrySet();
+ assertEquals( "Set contains the wrong number of items.", size, entries.size() );
+
+ // check minimal correctness
+ Object[] entryArray = entries.toArray();
+ for ( int i = 0; i < size; i++ )
+ {
+ Entry data = (Entry)entryArray[i];
+ assertTrue( "Data is wrong.", data.getValue().toString().indexOf( "data:") != -1 );
+ }
+ }
+
+
+}
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/SingleLinkedListUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/SingleLinkedListUnitTest.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/SingleLinkedListUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/SingleLinkedListUnitTest.java Thu May 10 09:03:42 2007
@@ -1,85 +1,104 @@
-package org.apache.jcs.utils.struct;
-
-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 list = new SingleLinkedList();
-
- // DO WORK
- Object result = list.takeFirst();
-
- // VERIFY
- assertNull( "Shounldn't have anything.", result );
- }
-
- /**
- * Verify FIFO behavior. Verifies that all items are removed.
- */
- public void testAddABunchAndTakeFromList()
- {
- // SETUP
- SingleLinkedList list = new SingleLinkedList();
-
- // DO WORK
- int numToPut = 100;
- for ( int i = 0; i < numToPut; i++ )
- {
- list.addLast( new Integer( i ) );
- }
-
- // VERIFY
- assertEquals( "Wrong nubmer in list.", numToPut, list.size() );
-
- for ( int i = 0; i < numToPut; i++ )
- {
- Object result = list.takeFirst();
- assertEquals( "Wrong value returned.", new Integer( i ), result );
- }
-
- // DO WORK
- Object result = list.takeFirst();
-
- // VERIFY
- assertNull( "Shounldn't have anything left.", result );
- }
-
- /**
- * Verify that after calling clear all items are removed adn the size is 0.
- */
- public void testAddABunchAndClear()
- {
- // SETUP
- SingleLinkedList list = new SingleLinkedList();
-
- // DO WORK
- int numToPut = 100;
- for ( int i = 0; i < numToPut; i++ )
- {
- list.addLast( new Integer( i ) );
- }
-
- // VERIFY
- assertEquals( "Wrong nubmer in list.", numToPut, list.size() );
-
- // DO WORK
- list.clear();
- Object result = list.takeFirst();
-
- // VERIFY
- assertEquals( "Wrong nubmer in list.", 0, list.size() );
- assertNull( "Shounldn't have anything left.", result );
- }
-}
+package org.apache.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 list = new SingleLinkedList();
+
+ // DO WORK
+ Object result = list.takeFirst();
+
+ // VERIFY
+ assertNull( "Shounldn't have anything.", result );
+ }
+
+ /**
+ * Verify FIFO behavior. Verifies that all items are removed.
+ */
+ public void testAddABunchAndTakeFromList()
+ {
+ // SETUP
+ SingleLinkedList list = new SingleLinkedList();
+
+ // DO WORK
+ int numToPut = 100;
+ for ( int i = 0; i < numToPut; i++ )
+ {
+ list.addLast( new Integer( i ) );
+ }
+
+ // VERIFY
+ assertEquals( "Wrong nubmer in list.", numToPut, list.size() );
+
+ for ( int i = 0; i < numToPut; i++ )
+ {
+ Object result = list.takeFirst();
+ assertEquals( "Wrong value returned.", new Integer( i ), result );
+ }
+
+ // DO WORK
+ Object result = list.takeFirst();
+
+ // VERIFY
+ assertNull( "Shounldn't have anything left.", result );
+ }
+
+ /**
+ * Verify that after calling clear all items are removed adn the size is 0.
+ */
+ public void testAddABunchAndClear()
+ {
+ // SETUP
+ SingleLinkedList list = new SingleLinkedList();
+
+ // DO WORK
+ int numToPut = 100;
+ for ( int i = 0; i < numToPut; i++ )
+ {
+ list.addLast( new Integer( i ) );
+ }
+
+ // VERIFY
+ assertEquals( "Wrong nubmer in list.", numToPut, list.size() );
+
+ // DO WORK
+ list.clear();
+ Object result = list.takeFirst();
+
+ // VERIFY
+ assertEquals( "Wrong nubmer in list.", 0, list.size() );
+ assertNull( "Shounldn't have anything left.", result );
+ }
+}
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/SortedPrefArrayUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/SortedPrefArrayUnitTest.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/SortedPrefArrayUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/SortedPrefArrayUnitTest.java Thu May 10 09:03:42 2007
@@ -1,12 +1,22 @@
package org.apache.jcs.utils.struct;
/*
- * 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.
+ * 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;
@@ -425,7 +435,7 @@
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.
*/
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java Thu May 10 09:03:42 2007
@@ -1,185 +1,204 @@
-package org.apache.jcs.utils.threadpool;
-
-import java.util.ArrayList;
-
-import junit.framework.TestCase;
-
-import org.apache.jcs.utils.props.PropertyLoader;
-
-import EDU.oswego.cs.dl.util.concurrent.BoundedBuffer;
-import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
-
-/**
- * Verify that the manager can create pools as intended by the default and
- * specified file names.
- *
- * @author asmuts
- */
-public class ThreadPoolManagerUnitTest
- extends TestCase
-{
-
- /**
- * Make sure it can load a default cache.ccf file
- */
- public void testDefaultConfig()
- {
- ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
- ThreadPoolManager mgr = ThreadPoolManager.getInstance();
- assertNotNull( mgr );
-
- ThreadPool pool = mgr.getPool( "test1" );
- assertNotNull( pool );
-
- int poolSize = pool.getPool().getPoolSize();
- int expectedPoolSize = Integer.parseInt( PropertyLoader.loadProperties( "thread_pool.properties" )
- .getProperty( "thread_pool.test1.startUpSize" ) );
- assertEquals( poolSize, expectedPoolSize );
-
- // int qs = ((BoundedBuffer)pool.getQueue()).size();
-
- int max = pool.getPool().getMaximumPoolSize();
- System.out.println( max );
-
- int expected = Integer.parseInt( PropertyLoader.loadProperties( "thread_pool.properties" )
- .getProperty( "thread_pool.test1.maximumPoolSize" ) );
- // "Max should be " + expected",
- assertEquals( max, expected );
- }
-
- /**
- * Try to get an undefined pool from an existing default file.
- */
- public void testDefaultConfigUndefinedPool()
- {
- ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
- ThreadPoolManager mgr = ThreadPoolManager.getInstance();
- assertNotNull( mgr );
-
- ThreadPool pool = mgr.getPool( "doesnotexist" );
- assertNotNull( pool );
-
- int max = pool.getPool().getMaximumPoolSize();
- System.out.println( max );
-
- int expected = Integer.parseInt( PropertyLoader.loadProperties( "thread_pool.properties" )
- .getProperty( "thread_pool.default.maximumPoolSize" ) );
- // "Max should be " + expected",
- assertEquals( max, expected );
- }
-
- /**
- * Makes ure we can get a non existent pool from the non exitent config
- * file.
- */
- public void testNonExistentConfigFile()
- {
- ThreadPoolManager.setPropsFileName( "somefilethatdoesntexist" );
- ThreadPoolManager mgr = ThreadPoolManager.getInstance();
- assertNotNull( mgr );
-
- ThreadPool pool = mgr.getPool( "doesntexist" );
- assertNotNull( "Should have gotten back a pool configured like the default", pool );
-
- int max = pool.getPool().getMaximumPoolSize();
- System.out.println( max );
-
- // it will load from the default file
- int expected = Integer.parseInt( PropertyLoader.loadProperties( "cache.ccf" )
- .getProperty( "thread_pool.default.maximumPoolSize" ) );
-
- // "Max should be " + expected",
- assertEquals( max, expected );
- }
-
- /**
- * Get a couple pools by name and then see if they are in the list.
- *
- */
- public void testGetPoolNames()
- {
- ThreadPoolManager mgr = ThreadPoolManager.getInstance();
- assertNotNull( mgr );
-
- String poolName1 = "testGetPoolNames1";
- mgr.getPool( poolName1 );
-
- String poolName2 = "testGetPoolNames2";
- mgr.getPool( poolName2 );
-
- ArrayList names = mgr.getPoolNames();
- assertTrue( "Should have name in list.", names.contains( poolName1 ) );
- assertTrue( "Should have name in list.", names.contains( poolName2 ) );
- }
-
- /**
- * Verify that the wait policy gets set correctly.
- *
- */
- public void testWaitPolicyConfig()
- {
- ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
- ThreadPoolManager mgr = ThreadPoolManager.getInstance();
- // force config from new props file
- mgr.configure();
- assertNotNull( mgr );
-
- ThreadPool pool = mgr.getPool( "waittest" );
- assertNotNull( "Should have gotten back a pool.", pool );
-
- int max = pool.getPool().getMaximumPoolSize();
- System.out.println( "testWaitPolicyConfig " + max );
-
- // it will load from the default file
- int expected = Integer.parseInt( PropertyLoader.loadProperties( "thread_pool.properties" )
- .getProperty( "thread_pool.waittest.maximumPoolSize" ) );
-
- // "Max should be " + expected",
- assertEquals( "Max is wrong", max, expected );
-
- PoolConfiguration config = mgr.loadConfig( "thread_pool.waittest" );
-
- assertEquals( "Policy is wrong.", PoolConfiguration.POLICY_WAIT, config.getWhenBlockedPolicy() );
-
- }
-
- /**
- * Verify that if we specify not to use a buffer boundary that we get a
- * linked queue.
- *
- */
- public void testNoBoundary()
- {
- ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
- ThreadPoolManager mgr = ThreadPoolManager.getInstance();
- // force config from new props file
- mgr.configure();
- assertNotNull( mgr );
-
- ThreadPool pool = mgr.getPool( "nobound" );
- assertNotNull( "Should have gotten back a pool.", pool );
-
- assertTrue( "Should have a linked queue and not a bounded buffer.", pool.getQueue() instanceof LinkedQueue );
- }
-
- /**
- * Verify that if we specify useBoundary=true that we get a BoundedBuffer.
- *
- */
- public void testWithBoundary()
- {
- // SETUP
- ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
- ThreadPoolManager mgr = ThreadPoolManager.getInstance();
- // force config from new props file
- mgr.configure();
- assertNotNull( mgr );
-
- // DO WORK
- ThreadPool pool = mgr.getPool( "withbound" );
-
- // VERIFY
- assertNotNull( "Should have gotten back a pool.", pool );
- assertTrue( "Should have a BoundedBuffer and not a linked queue.", pool.getQueue() instanceof BoundedBuffer );
- }
-}
+package org.apache.jcs.utils.threadpool;
+
+/*
+ * 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 java.util.ArrayList;
+
+import junit.framework.TestCase;
+
+import org.apache.jcs.utils.props.PropertyLoader;
+
+import EDU.oswego.cs.dl.util.concurrent.BoundedBuffer;
+import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
+
+/**
+ * Verify that the manager can create pools as intended by the default and
+ * specified file names.
+ *
+ * @author asmuts
+ */
+public class ThreadPoolManagerUnitTest
+ extends TestCase
+{
+
+ /**
+ * Make sure it can load a default cache.ccf file
+ */
+ public void testDefaultConfig()
+ {
+ ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
+ ThreadPoolManager mgr = ThreadPoolManager.getInstance();
+ assertNotNull( mgr );
+
+ ThreadPool pool = mgr.getPool( "test1" );
+ assertNotNull( pool );
+
+ int poolSize = pool.getPool().getPoolSize();
+ int expectedPoolSize = Integer.parseInt( PropertyLoader.loadProperties( "thread_pool.properties" )
+ .getProperty( "thread_pool.test1.startUpSize" ) );
+ assertEquals( poolSize, expectedPoolSize );
+
+ // int qs = ((BoundedBuffer)pool.getQueue()).size();
+
+ int max = pool.getPool().getMaximumPoolSize();
+ System.out.println( max );
+
+ int expected = Integer.parseInt( PropertyLoader.loadProperties( "thread_pool.properties" )
+ .getProperty( "thread_pool.test1.maximumPoolSize" ) );
+ // "Max should be " + expected",
+ assertEquals( max, expected );
+ }
+
+ /**
+ * Try to get an undefined pool from an existing default file.
+ */
+ public void testDefaultConfigUndefinedPool()
+ {
+ ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
+ ThreadPoolManager mgr = ThreadPoolManager.getInstance();
+ assertNotNull( mgr );
+
+ ThreadPool pool = mgr.getPool( "doesnotexist" );
+ assertNotNull( pool );
+
+ int max = pool.getPool().getMaximumPoolSize();
+ System.out.println( max );
+
+ int expected = Integer.parseInt( PropertyLoader.loadProperties( "thread_pool.properties" )
+ .getProperty( "thread_pool.default.maximumPoolSize" ) );
+ // "Max should be " + expected",
+ assertEquals( max, expected );
+ }
+
+ /**
+ * Makes ure we can get a non existent pool from the non exitent config
+ * file.
+ */
+ public void testNonExistentConfigFile()
+ {
+ ThreadPoolManager.setPropsFileName( "somefilethatdoesntexist" );
+ ThreadPoolManager mgr = ThreadPoolManager.getInstance();
+ assertNotNull( mgr );
+
+ ThreadPool pool = mgr.getPool( "doesntexist" );
+ assertNotNull( "Should have gotten back a pool configured like the default", pool );
+
+ int max = pool.getPool().getMaximumPoolSize();
+ System.out.println( max );
+
+ // it will load from the default file
+ int expected = Integer.parseInt( PropertyLoader.loadProperties( "cache.ccf" )
+ .getProperty( "thread_pool.default.maximumPoolSize" ) );
+
+ // "Max should be " + expected",
+ assertEquals( max, expected );
+ }
+
+ /**
+ * Get a couple pools by name and then see if they are in the list.
+ *
+ */
+ public void testGetPoolNames()
+ {
+ ThreadPoolManager mgr = ThreadPoolManager.getInstance();
+ assertNotNull( mgr );
+
+ String poolName1 = "testGetPoolNames1";
+ mgr.getPool( poolName1 );
+
+ String poolName2 = "testGetPoolNames2";
+ mgr.getPool( poolName2 );
+
+ ArrayList names = mgr.getPoolNames();
+ assertTrue( "Should have name in list.", names.contains( poolName1 ) );
+ assertTrue( "Should have name in list.", names.contains( poolName2 ) );
+ }
+
+ /**
+ * Verify that the wait policy gets set correctly.
+ *
+ */
+ public void testWaitPolicyConfig()
+ {
+ ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
+ ThreadPoolManager mgr = ThreadPoolManager.getInstance();
+ // force config from new props file
+ mgr.configure();
+ assertNotNull( mgr );
+
+ ThreadPool pool = mgr.getPool( "waittest" );
+ assertNotNull( "Should have gotten back a pool.", pool );
+
+ int max = pool.getPool().getMaximumPoolSize();
+ System.out.println( "testWaitPolicyConfig " + max );
+
+ // it will load from the default file
+ int expected = Integer.parseInt( PropertyLoader.loadProperties( "thread_pool.properties" )
+ .getProperty( "thread_pool.waittest.maximumPoolSize" ) );
+
+ // "Max should be " + expected",
+ assertEquals( "Max is wrong", max, expected );
+
+ PoolConfiguration config = mgr.loadConfig( "thread_pool.waittest" );
+
+ assertEquals( "Policy is wrong.", PoolConfiguration.POLICY_WAIT, config.getWhenBlockedPolicy() );
+
+ }
+
+ /**
+ * Verify that if we specify not to use a buffer boundary that we get a
+ * linked queue.
+ *
+ */
+ public void testNoBoundary()
+ {
+ ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
+ ThreadPoolManager mgr = ThreadPoolManager.getInstance();
+ // force config from new props file
+ mgr.configure();
+ assertNotNull( mgr );
+
+ ThreadPool pool = mgr.getPool( "nobound" );
+ assertNotNull( "Should have gotten back a pool.", pool );
+
+ assertTrue( "Should have a linked queue and not a bounded buffer.", pool.getQueue() instanceof LinkedQueue );
+ }
+
+ /**
+ * Verify that if we specify useBoundary=true that we get a BoundedBuffer.
+ *
+ */
+ public void testWithBoundary()
+ {
+ // SETUP
+ ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
+ ThreadPoolManager mgr = ThreadPoolManager.getInstance();
+ // force config from new props file
+ mgr.configure();
+ assertNotNull( mgr );
+
+ // DO WORK
+ ThreadPool pool = mgr.getPool( "withbound" );
+
+ // VERIFY
+ assertNotNull( "Should have gotten back a pool.", pool );
+ assertTrue( "Should have a BoundedBuffer and not a linked queue.", pool.getQueue() instanceof BoundedBuffer );
+ }
+}
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java Thu May 10 09:03:42 2007
@@ -1,82 +1,101 @@
-package org.apache.jcs.utils.threadpool;
-
-import junit.framework.TestCase;
-
-/**
- * This test is experiemental. I'm trying to find out if the max size setting
- * will result in the removal of threads.
- *
- * @author Aaron Smuts
- *
- */
-public class ThreadPoolUnitTest
- extends TestCase
-{
-
- /**
- * Make sure that the max size setting takes effect before the idle
- * time is reached.
- *
- * We just want to ensure that we can adjust the max size of an active pool.
- *
- * http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PooledExecutor.html#setMaximumPoolSize(int)
- *
- * @throws Exception
- */
- public void testMaxReduction()
- throws Exception
- {
- //ThreadPoolManager.setPropsFileName( "thread_pool_test.properties" );
- ThreadPool pool = ThreadPoolManager.getInstance().getPool( "maxtest" );
-
- System.out.println( "pool = " + pool );
-
- pool.getPool().setMaximumPoolSize( 5 );
-
- System.out.println( "current size before execute = " + pool.getPool().getPoolSize() );
-
-
- // add 6
- for ( int i = 1; i < 30; i++ )
- {
- final ThreadPool myPool = pool;
- final int cnt = i;
- pool.execute( new Runnable()
- {
-
- public void run()
- {
- try
- {
- //System.out.println( cnt );
- System.out.println( "count = " + cnt + " before sleep current size = " + myPool.getPool().getPoolSize() );
- Thread.sleep( 200 / cnt );
- System.out.println( "count = " + cnt + " after sleep current size = " + myPool.getPool().getPoolSize() );
- }
- catch ( InterruptedException e )
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- } );
-
- }
-
- System.out.println( "current size = " + pool.getPool().getPoolSize() );
-
- pool.getPool().setMaximumPoolSize( 4 );
-
- //Thread.sleep( 200 );
-
- System.out.println( "current size after set size to 4= " + pool.getPool().getPoolSize() );
-
- Thread.sleep( 200 );
-
- System.out.println( "current size again after sleep = " + pool.getPool().getPoolSize() );
-
- assertEquals( "Pool size should have been reduced.", 4, pool.getPool().getPoolSize() );
- }
-
-}
+package org.apache.jcs.utils.threadpool;
+
+/*
+ * 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;
+
+/**
+ * This test is experiemental. I'm trying to find out if the max size setting
+ * will result in the removal of threads.
+ *
+ * @author Aaron Smuts
+ *
+ */
+public class ThreadPoolUnitTest
+ extends TestCase
+{
+
+ /**
+ * Make sure that the max size setting takes effect before the idle
+ * time is reached.
+ *
+ * We just want to ensure that we can adjust the max size of an active pool.
+ *
+ * http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PooledExecutor.html#setMaximumPoolSize(int)
+ *
+ * @throws Exception
+ */
+ public void testMaxReduction()
+ throws Exception
+ {
+ //ThreadPoolManager.setPropsFileName( "thread_pool_test.properties" );
+ ThreadPool pool = ThreadPoolManager.getInstance().getPool( "maxtest" );
+
+ System.out.println( "pool = " + pool );
+
+ pool.getPool().setMaximumPoolSize( 5 );
+
+ System.out.println( "current size before execute = " + pool.getPool().getPoolSize() );
+
+
+ // add 6
+ for ( int i = 1; i < 30; i++ )
+ {
+ final ThreadPool myPool = pool;
+ final int cnt = i;
+ pool.execute( new Runnable()
+ {
+
+ public void run()
+ {
+ try
+ {
+ //System.out.println( cnt );
+ System.out.println( "count = " + cnt + " before sleep current size = " + myPool.getPool().getPoolSize() );
+ Thread.sleep( 200 / cnt );
+ System.out.println( "count = " + cnt + " after sleep current size = " + myPool.getPool().getPoolSize() );
+ }
+ catch ( InterruptedException e )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ } );
+
+ }
+
+ System.out.println( "current size = " + pool.getPool().getPoolSize() );
+
+ pool.getPool().setMaximumPoolSize( 4 );
+
+ //Thread.sleep( 200 );
+
+ System.out.println( "current size after set size to 4= " + pool.getPool().getPoolSize() );
+
+ Thread.sleep( 200 );
+
+ System.out.println( "current size again after sleep = " + pool.getPool().getPoolSize() );
+
+ assertEquals( "Pool size should have been reduced.", 4, pool.getPool().getPoolSize() );
+ }
+
+}
Modified: jakarta/jcs/trunk/xdocs/BDBJEDiskCache.ccf
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/BDBJEDiskCache.ccf?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/xdocs/BDBJEDiskCache.ccf (original)
+++ jakarta/jcs/trunk/xdocs/BDBJEDiskCache.ccf Thu May 10 09:03:42 2007
@@ -1,68 +1,84 @@
-<?xml version="1.0"?>
-
-<document>
- <properties>
- <title>Berkeley DB Disk Auxiliary Cache</title>
- <author email="ASmuts@yahoo.com">Aaron Smuts</author>
- </properties>
-
- <body>
- <section name="Berkeley DB Disk Auxiliary Cache">
- <p>
- The Berkeley DB Disk Auxiliary Cache is an optional plugin for the
- JCS. It is primarily intended to provide a secondary store to
- ease the memory burden of the cache. When the memory cache
- exceeds its maximum size it tells the cache hub that the item
- to be removed from memory should be spooled to disk. The cache
- checks to see if any auxiliaries of type "disk" have been
- configured for the region. If the "Berkeley DB Disk Auxiliary Cache"
- is used, the item will be spooled to disk.
- </p>
- <p>
- The Berkeley DB is far slower than the Indexed Disk Cache, especially for puts.
- This is partially due to the fact that the BDB store its keys on disk.
- However, any items stored in the BDB will be available on restart, even if
- the cache is not shutdown properly.
- </p>
- <p>
- The Berkeley DB requires jdk1.4 and above. As such, it is distributed
- in the jdk14-ext jar.
- </p>
-
- <subsection name="Configuration">
- <p>
- The configuration is simple and is done in the auxiliary
- cache section of the <code>cache.ccf</code> configuration file.
- In the example below, I created a Berkeley DB Auxiliary Cache
- referenced by <code>BDBDC</code>. It uses files located in the
- "DiskPath" directory.
- </p>
-
- <source><![CDATA[
-##############################################################
-##### Default Region Configuration
-jcs.default=BDBDC
-jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
-jcs.default.cacheattributes.MaxObjects=100
-jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
-
-##############################################################
-##### CACHE REGIONS
-jcs.region.myRegion1=BDBDC
-jcs.region.myRegion1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
-jcs.region.myRegion1.cacheattributes.MaxObjects=1000
-jcs.region.myRegion1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
-
-##############################################################
-##### AUXILIARY CACHES
-# Berkeley DB JE
-jcs.auxiliary.BDBDC=org.apache.jcs.auxiliary.disk.bdbje.BDBJECacheFactory
-jcs.auxiliary.BDBDC.attributes=org.apache.jcs.auxiliary.disk.bdbje.BDBJECacheAttributes
-jcs.auxiliary.BDBDC.attributes.DiskPath=target/
-jcs.auxiliary.BDBDC.attributes.MaxPurgatorySize=100000
- ]]></source>
- </subsection>
-
- </section>
- </body>
-</document>
\ No newline at end of file
+# 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.
+<?xml version="1.0"?>
+
+<document>
+ <properties>
+ <title>Berkeley DB Disk Auxiliary Cache</title>
+ <author email="ASmuts@yahoo.com">Aaron Smuts</author>
+ </properties>
+
+ <body>
+ <section name="Berkeley DB Disk Auxiliary Cache">
+ <p>
+ The Berkeley DB Disk Auxiliary Cache is an optional plugin for the
+ JCS. It is primarily intended to provide a secondary store to
+ ease the memory burden of the cache. When the memory cache
+ exceeds its maximum size it tells the cache hub that the item
+ to be removed from memory should be spooled to disk. The cache
+ checks to see if any auxiliaries of type "disk" have been
+ configured for the region. If the "Berkeley DB Disk Auxiliary Cache"
+ is used, the item will be spooled to disk.
+ </p>
+ <p>
+ The Berkeley DB is far slower than the Indexed Disk Cache, especially for puts.
+ This is partially due to the fact that the BDB store its keys on disk.
+ However, any items stored in the BDB will be available on restart, even if
+ the cache is not shutdown properly.
+ </p>
+ <p>
+ The Berkeley DB requires jdk1.4 and above. As such, it is distributed
+ in the jdk14-ext jar.
+ </p>
+
+ <subsection name="Configuration">
+ <p>
+ The configuration is simple and is done in the auxiliary
+ cache section of the <code>cache.ccf</code> configuration file.
+ In the example below, I created a Berkeley DB Auxiliary Cache
+ referenced by <code>BDBDC</code>. It uses files located in the
+ "DiskPath" directory.
+ </p>
+
+ <source><![CDATA[
+# #############################################################
+# #### Default Region Configuration
+jcs.default=BDBDC
+jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.default.cacheattributes.MaxObjects=100
+jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+
+# #############################################################
+# #### CACHE REGIONS
+jcs.region.myRegion1=BDBDC
+jcs.region.myRegion1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.region.myRegion1.cacheattributes.MaxObjects=1000
+jcs.region.myRegion1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+
+# #############################################################
+# #### AUXILIARY CACHES
+# Berkeley DB JE
+jcs.auxiliary.BDBDC=org.apache.jcs.auxiliary.disk.bdbje.BDBJECacheFactory
+jcs.auxiliary.BDBDC.attributes=org.apache.jcs.auxiliary.disk.bdbje.BDBJECacheAttributes
+jcs.auxiliary.BDBDC.attributes.DiskPath=target/
+jcs.auxiliary.BDBDC.attributes.MaxPurgatorySize=100000
+ ]]></source>
+ </subsection>
+
+ </section>
+ </body>
+</document>
Modified: jakarta/jcs/trunk/xdocs/BasicJCSConfiguration.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/BasicJCSConfiguration.xml?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/xdocs/BasicJCSConfiguration.xml (original)
+++ jakarta/jcs/trunk/xdocs/BasicJCSConfiguration.xml Thu May 10 09:03:42 2007
@@ -1,4 +1,22 @@
<?xml version="1.0"?>
+<!--
+ 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.
+-->
<document>
<properties>
@@ -7,7 +25,7 @@
</properties>
<body>
- <section name="Basic JCS Configuration">
+ <section name="Basic JCS Configuration">
<p>
The following document illustrates several basic JCS
configurations. As you'll see, using JCS can be as simple as
@@ -24,7 +42,7 @@
file (cache.ccf) could look like this:
</p>
<source><![CDATA[
-# DEFAULT CACHE REGION
+# DEFAULT CACHE REGION
jcs.default=
jcs.default.cacheattributes=
@@ -58,13 +76,13 @@
jcs.auxiliary.DC.attributes=
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=g:/dev/jcs/raf
- ]]></source>
+ ]]></source>
<p>
and (2) change the first line to:
</p>
<source><![CDATA[
jcs.default=DC
- ]]></source>
+ ]]></source>
<p>
If you want to predefine a specific region, say called
<code>testCache1</code>, then add these lines:
@@ -120,15 +138,15 @@
</p>
<p>
Configuration is being refactored and is subject to change. It
- should only become easier.
+ should only become easier.
</p>
</subsection>
<subsection name="The complete file">
<p>
- The complete file from above would look like this:
+ The complete file from above would look like this:
</p>
<source><![CDATA[
-# DEFAULT CACHE REGION
+# DEFAULT CACHE REGION
jcs.default=DC,LTCP
jcs.default.cacheattributes=
@@ -137,7 +155,7 @@
jcs.default.cacheattributes.MemoryCacheName=
org.apache.jcs.engine.memory.lru.LRUMemoryCache
-# PRE-DEFINED CACHE REGIONS
+# PRE-DEFINED CACHE REGIONS
jcs.region.testCache1=DC,LTCP
jcs.region.testCache1.cacheattributes=
@@ -153,7 +171,7 @@
jcs.region.testCache1.elementattributes.IsEternal=false
-# AVAILABLE AUXILIARY CACHES
+# AVAILABLE AUXILIARY CACHES
jcs.auxiliary.DC=
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=
Modified: jakarta/jcs/trunk/xdocs/BlockDiskCache.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/BlockDiskCache.xml?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/xdocs/BlockDiskCache.xml (original)
+++ jakarta/jcs/trunk/xdocs/BlockDiskCache.xml Thu May 10 09:03:42 2007
@@ -1,74 +1,92 @@
-<?xml version="1.0"?>
-
-<document>
- <properties>
- <title>Block Disk Cache</title>
- <author email="asmuts@apache.org">Aaron Smuts</author>
- </properties>
-
- <body>
- <section name="Block Disk Auxiliary Cache">
- <p>
- The Block Disk Cache stores cached values on disk. Like
- the Indexed Disk Cache, the Block Disk Cache keeps the
- keys in memory. The Block Disk Cache stores the values
- in a group of fixed size blocks, whereas the Indexed
- Disk Cache writes items to disk in one chunk.
- </p>
- <p>
- The Block Disk Cache has advantages over the normal
- indexed model for regions where the size of the items
- varies. Since all the blocks are the same size, the
- recycle bin is very simple. It is just a list of block
- numbers. Also, the Block Disk Cache will never need to
- be optimized. Once the maximum number of keys is
- reached, blocks will be reused.
- </p>
-
- <subsection name="Example cache.ccf">
- <source>
- <![CDATA[
-##############################################################
-##### DEFAULT REGION ########################################
-
-jcs.default=blockDiskCache
-jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
-jcs.default.cacheattributes.MaxObjects=0
-jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
-
-##############################################################
-##### AUXILIARY CACHES ######################################
-
-# Block Disk Cache
-jcs.auxiliary.blockDiskCache=org.apache.jcs.auxiliary.disk.block.BlockDiskCacheFactory
-jcs.auxiliary.blockDiskCache.attributes=org.apache.jcs.auxiliary.disk.block.BlockDiskCacheAttributes
-jcs.auxiliary.blockDiskCache.attributes.DiskPath=target/test-sandbox/block-disk-cache-huge
-jcs.auxiliary.blockDiskCache.attributes.MaxPurgatorySize=300000
-jcs.auxiliary.blockDiskCache.attributes.MaxKeySize=1000000
-jcs.auxiliary.blockDiskCache.attributes.blockSizeBytes=500
-jcs.auxiliary.blockDiskCache.attributes.EventQueueType=SINGLE
-#jcs.auxiliary.blockDiskCache.attributes.EventQueuePoolName=disk_cache_event_queue
-
-##############################################################
-################## THREAD POOL CONFIGURATION #################
-
-# Default thread pool config
-thread_pool.default.boundarySize=2000
-thread_pool.default.maximumPoolSize=150
-thread_pool.default.minimumPoolSize=4
-thread_pool.default.keepAliveTime=350000
-#RUN ABORT WAIT BLOCK DISCARDOLDEST
-thread_pool.default.whenBlockedPolicy=RUN
-thread_pool.default.startUpSize=4
-
-# Disk Cache pool
-thread_pool.disk_cache_event_queue.useBoundary=false
-thread_pool.disk_cache_event_queue.minimumPoolSize=2
-thread_pool.disk_cache_event_queue.keepAliveTime=3500
-thread_pool.disk_cache_event_queue.startUpSize=10
- ]]>
- </source>
- </subsection>
- </section>
- </body>
-</document>
\ No newline at end of file
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<document>
+ <properties>
+ <title>Block Disk Cache</title>
+ <author email="asmuts@apache.org">Aaron Smuts</author>
+ </properties>
+
+ <body>
+ <section name="Block Disk Auxiliary Cache">
+ <p>
+ The Block Disk Cache stores cached values on disk. Like
+ the Indexed Disk Cache, the Block Disk Cache keeps the
+ keys in memory. The Block Disk Cache stores the values
+ in a group of fixed size blocks, whereas the Indexed
+ Disk Cache writes items to disk in one chunk.
+ </p>
+ <p>
+ The Block Disk Cache has advantages over the normal
+ indexed model for regions where the size of the items
+ varies. Since all the blocks are the same size, the
+ recycle bin is very simple. It is just a list of block
+ numbers. Also, the Block Disk Cache will never need to
+ be optimized. Once the maximum number of keys is
+ reached, blocks will be reused.
+ </p>
+
+ <subsection name="Example cache.ccf">
+ <source>
+ <![CDATA[
+##############################################################
+##### DEFAULT REGION ########################################
+
+jcs.default=blockDiskCache
+jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.default.cacheattributes.MaxObjects=0
+jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+
+##############################################################
+##### AUXILIARY CACHES ######################################
+
+# Block Disk Cache
+jcs.auxiliary.blockDiskCache=org.apache.jcs.auxiliary.disk.block.BlockDiskCacheFactory
+jcs.auxiliary.blockDiskCache.attributes=org.apache.jcs.auxiliary.disk.block.BlockDiskCacheAttributes
+jcs.auxiliary.blockDiskCache.attributes.DiskPath=target/test-sandbox/block-disk-cache-huge
+jcs.auxiliary.blockDiskCache.attributes.MaxPurgatorySize=300000
+jcs.auxiliary.blockDiskCache.attributes.MaxKeySize=1000000
+jcs.auxiliary.blockDiskCache.attributes.blockSizeBytes=500
+jcs.auxiliary.blockDiskCache.attributes.EventQueueType=SINGLE
+#jcs.auxiliary.blockDiskCache.attributes.EventQueuePoolName=disk_cache_event_queue
+
+##############################################################
+################## THREAD POOL CONFIGURATION #################
+
+# Default thread pool config
+thread_pool.default.boundarySize=2000
+thread_pool.default.maximumPoolSize=150
+thread_pool.default.minimumPoolSize=4
+thread_pool.default.keepAliveTime=350000
+#RUN ABORT WAIT BLOCK DISCARDOLDEST
+thread_pool.default.whenBlockedPolicy=RUN
+thread_pool.default.startUpSize=4
+
+# Disk Cache pool
+thread_pool.disk_cache_event_queue.useBoundary=false
+thread_pool.disk_cache_event_queue.minimumPoolSize=2
+thread_pool.disk_cache_event_queue.keepAliveTime=3500
+thread_pool.disk_cache_event_queue.startUpSize=10
+ ]]>
+ </source>
+ </subsection>
+ </section>
+ </body>
+</document>
Modified: jakarta/jcs/trunk/xdocs/DownloadPage.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/DownloadPage.xml?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/xdocs/DownloadPage.xml (original)
+++ jakarta/jcs/trunk/xdocs/DownloadPage.xml Thu May 10 09:03:42 2007
@@ -1,28 +1,46 @@
-<?xml version="1.0"?>
-
-<document>
- <properties>
- <title>Downloads</title>
- <author email="asmuts@apache.org">Aaron Smuts</author>
- </properties>
-
- <body>
- <section name="Binaries">
- <p>
- We will be offering a release via the standard Jakarta
- download page very soon.
- </p>
- <p>
- For now, you can find versioned binary releases of JCS in
- the tempbuild directory of the repository.
- </p>
- <p>
- <a href="http://svn.apache.org/viewcvs.cgi/jakarta/jcs/trunk/tempbuild/">HERE</a>
- </p>
- <p>
- The core JCS jar is compiled using JDK 1.3.
- </p>
- </section>
- </body>
-</document>
-
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<document>
+ <properties>
+ <title>Downloads</title>
+ <author email="asmuts@apache.org">Aaron Smuts</author>
+ </properties>
+
+ <body>
+ <section name="Binaries">
+ <p>
+ We will be offering a release via the standard Jakarta
+ download page very soon.
+ </p>
+ <p>
+ For now, you can find versioned binary releases of JCS in
+ the tempbuild directory of the repository.
+ </p>
+ <p>
+ <a href="http://svn.apache.org/viewcvs.cgi/jakarta/jcs/trunk/tempbuild/">HERE</a>
+ </p>
+ <p>
+ The core JCS jar is compiled using JDK 1.3.
+ </p>
+ </section>
+ </body>
+</document>
+
Modified: jakarta/jcs/trunk/xdocs/Downloads.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/Downloads.xml?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/xdocs/Downloads.xml (original)
+++ jakarta/jcs/trunk/xdocs/Downloads.xml Thu May 10 09:03:42 2007
@@ -1,25 +1,43 @@
<?xml version="1.0"?>
+<!--
+ 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.
+-->
<document>
<properties>
- <title>Downloads</title>
+ <title>Downloads</title>
<author email="asmuts@apache.org">Aaron Smuts</author>
</properties>
<body>
- <section name="Binaries">
- <p>
+ <section name="Binaries">
+ <p>
We will be offering a release via the standard Jakarta
download page very soon.
</p>
- <p>
- For now, you can find versioned binary releases of JCS in
- the tempbuild directory of the repository.
+ <p>
+ For now, you can find versioned binary releases of JCS in
+ the tempbuild directory of the repository.
</p>
- <p>
+ <p>
<a href="http://svn.apache.org/viewcvs.cgi/jakarta/jcs/trunk/tempbuild/">HERE</a>
</p>
- <p>
+ <p>
The core JCS jar is compiled using JDK 1.3.
</p>
</section>
Modified: jakarta/jcs/trunk/xdocs/ElementAttributes.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/ElementAttributes.xml?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/xdocs/ElementAttributes.xml (original)
+++ jakarta/jcs/trunk/xdocs/ElementAttributes.xml Thu May 10 09:03:42 2007
@@ -1,4 +1,22 @@
<?xml version="1.0"?>
+<!--
+ 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.
+-->
<document>
<properties>
@@ -27,7 +45,7 @@
</p>
<source>
<![CDATA[
-# DEFAULT CACHE REGION
+# DEFAULT CACHE REGION
jcs.default=DC
jcs.default.cacheattributes=
@@ -37,14 +55,14 @@
org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.cacheattributes.UseMemoryShrinker=true
jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600
-jcs.default.cacheattributes.ShrinkerIntervalSeconds=60
+jcs.default.cacheattributes.ShrinkerIntervalSeconds=60
jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.default.elementattributes.IsEternal=false
jcs.default.elementattributes.MaxLifeSeconds=700
jcs.default.elementattributes.IdleTime=1800
jcs.default.elementattributes.IsSpool=true
jcs.default.elementattributes.IsRemote=true
-jcs.default.elementattributes.IsLateral=true
+jcs.default.elementattributes.IsLateral=true
]]>
</source>
<p>
@@ -126,11 +144,11 @@
for an element when you put it in the cache.
</p>
<source>
- <![CDATA[
+ <![CDATA[
JCS jcs = JCS.getInstance( "myregion" );
. . .
-
+
// jcs.getDefaultElementAttributes returns a copy not a reference
IElementAttributes attributes = jcs.getDefaultElementAttributes();
@@ -146,11 +164,11 @@
</p>
<source>
- <![CDATA[
+ <![CDATA[
JCS jcs = JCS.getInstance( "myregion" );
. . .
-
+
// jcs.getDefaultElementAttributes returns a copy not a reference
IElementAttributes attributes = jcs.getDefaultElementAttributes();
@@ -163,4 +181,4 @@
</section>
</body>
-</document>
\ No newline at end of file
+</document>
Modified: jakarta/jcs/trunk/xdocs/ElementEventHandling.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/ElementEventHandling.xml?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/xdocs/ElementEventHandling.xml (original)
+++ jakarta/jcs/trunk/xdocs/ElementEventHandling.xml Thu May 10 09:03:42 2007
@@ -1,167 +1,185 @@
-<?xml version="1.0"?>
-
-<document>
- <properties>
- <title>Element Event Handling</title>
- <author email="ASmuts@apache.org">Aaron Smuts</author>
- </properties>
-
- <body>
- <section name="Element Event Handling">
- <p>
- JCS allows you to attach event handlers to elements in
- the local memory cache.
- </p>
- <p>
- There are several events that you can listen for. All of
- the events are local memory related events. Element
- event handlers are not transmitted to other caches via
- lateral or remote auxiliaries, nor are they spooled to
- disk.
- </p>
- <p>
- You can register multiple handlers for a single item.
- Although the handlers are associated with particular
- items, you can also setup default handlers for any
- region. Each item put into the region, that will take
- the default element attributes, will be assigned the
- event default event handlers.
- </p>
- <p>
- The various events that you can handle have all been
- assigned integer codes. The codes are defined in the
- org.apache.jcs.engine.control.event.behavior.IElementEventConstants
- interface. The events are named descriptively and
- include:
- </p>
- <table>
- <tr>
- <th>Name</th>
- <th>Description</th>
- </tr>
- <tr>
- <td>ELEMENT_EVENT_EXCEEDED_MAXLIFE_BACKGROUND</td>
- <td>
- The element exceeded its max life. This was
- detected in a background cleanup.
- </td>
- </tr>
- <tr>
- <td>ELEMENT_EVENT_EXCEEDED_MAXLIFE_ONREQUEST</td>
- <td>
- The element exceeded its max life. This was
- detected on request.
- </td>
- </tr>
- <tr>
- <td>ELEMENT_EVENT_EXCEEDED_IDLETIME_BACKGROUND</td>
- <td>
- The element exceeded its max idle. This was
- detected in a background cleanup.
- </td>
- </tr>
- <tr>
- <td>ELEMENT_EVENT_EXCEEDED_IDLETIME_ONREQUEST</td>
- <td>
- The element exceeded its max idle time. This was
- detected on request.
- </td>
- </tr>
- <tr>
- <td>ELEMENT_EVENT_SPOOLED_DISK_AVAILABLE</td>
- <td>
- The element was pushed out of the memory store,
- there is a disk store available for the region,
- and the element is marked as spoolable.
- </td>
- </tr>
- <tr>
- <td>ELEMENT_EVENT_SPOOLED_DISK_NOT_AVAILABLE</td>
- <td>
- The element was pushed out of the memory store,
- and there is not a disk store available for the
- region.
- </td>
- </tr>
- <tr>
- <td>ELEMENT_EVENT_SPOOLED_NOT_ALLOWED</td>
- <td>
- The element was pushed out of the memory store,
- there is a disk store available for the region,
- but the element is marked as not spoolable.
- </td>
- </tr>
- </table>
- <p>
- To create an event handler you must implement the
- org.apache.jcs.engine.control.event.behavior.IElementEventHandler
- interface. This interface contains only one method:
- </p>
- <source>
- <![CDATA[
- public void handleElementEvent( IElementEvent event );
- ]]>
- </source>
- <p>
- The IElementEvent object contains both the event code
- and the source. The source is the element for which the
- event occurred. The code is the type of event. If you
- have an event handler registered, it will be called
- whenever any event occurs. It is up to the handler to
- decide what it would like to do for the particular
- event. Since there are not that many events, this does
- not create too much activity. Also, the event handling
- is done asynchronously. Events are added to an event
- queue and processed by background threads.
- </p>
- <p>
- Once you have an IElementEventHandler implementation,
- you can attach it to an element via the Element
- Attributes. You can either add it to the element
- attributes when you put an item into the cache, add it
- to the attributes of an item that exist in the cache
- (which just results in a re-put), or add the event
- handler to the default element attributes for a region.
- If you add it to the default attributes, then all
- elements subsequently added to the region that do not
- define their own element attributes will be assigned the
- default event handlers.
- </p>
- <source>
- <![CDATA[
- JCS jcs = JCS.getInstance( "myregion" );
-
- . . .
-
- MyEventHandler meh = new MyEventHandler();
-
- // jcs.getDefaultElementAttributes returns a copy not a reference
- IElementAttributes attributes = jcs.getDefaultElementAttributes();
- attributes.addElementEventHandler( meh );
- jcs.put( "key", "data", attributes );
- ]]>
- </source>
- <p>
- Here is how to setup an event handler as a default
- setting for a region:
- </p>
- <source>
- <![CDATA[
- JCS jcs = JCS.getInstance( "myregion" );
-
- . . .
-
- MyEventHandler meh = new MyEventHandler();
-
- // this should add the event handler to all items as
- //they are created.
- // jcs.getDefaultElementAttributes returns a copy not a reference
- IElementAttributes attributes = jcs.getDefaultElementAttributes();
- attributes.addElementEventHandler( meh );
- jcs.setDefaultElementAttributes( attributes );
- ]]>
- </source>
-
- </section>
- </body>
-</document>
\ No newline at end of file
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<document>
+ <properties>
+ <title>Element Event Handling</title>
+ <author email="ASmuts@apache.org">Aaron Smuts</author>
+ </properties>
+
+ <body>
+ <section name="Element Event Handling">
+ <p>
+ JCS allows you to attach event handlers to elements in
+ the local memory cache.
+ </p>
+ <p>
+ There are several events that you can listen for. All of
+ the events are local memory related events. Element
+ event handlers are not transmitted to other caches via
+ lateral or remote auxiliaries, nor are they spooled to
+ disk.
+ </p>
+ <p>
+ You can register multiple handlers for a single item.
+ Although the handlers are associated with particular
+ items, you can also setup default handlers for any
+ region. Each item put into the region, that will take
+ the default element attributes, will be assigned the
+ event default event handlers.
+ </p>
+ <p>
+ The various events that you can handle have all been
+ assigned integer codes. The codes are defined in the
+ org.apache.jcs.engine.control.event.behavior.IElementEventConstants
+ interface. The events are named descriptively and
+ include:
+ </p>
+ <table>
+ <tr>
+ <th>Name</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>ELEMENT_EVENT_EXCEEDED_MAXLIFE_BACKGROUND</td>
+ <td>
+ The element exceeded its max life. This was
+ detected in a background cleanup.
+ </td>
+ </tr>
+ <tr>
+ <td>ELEMENT_EVENT_EXCEEDED_MAXLIFE_ONREQUEST</td>
+ <td>
+ The element exceeded its max life. This was
+ detected on request.
+ </td>
+ </tr>
+ <tr>
+ <td>ELEMENT_EVENT_EXCEEDED_IDLETIME_BACKGROUND</td>
+ <td>
+ The element exceeded its max idle. This was
+ detected in a background cleanup.
+ </td>
+ </tr>
+ <tr>
+ <td>ELEMENT_EVENT_EXCEEDED_IDLETIME_ONREQUEST</td>
+ <td>
+ The element exceeded its max idle time. This was
+ detected on request.
+ </td>
+ </tr>
+ <tr>
+ <td>ELEMENT_EVENT_SPOOLED_DISK_AVAILABLE</td>
+ <td>
+ The element was pushed out of the memory store,
+ there is a disk store available for the region,
+ and the element is marked as spoolable.
+ </td>
+ </tr>
+ <tr>
+ <td>ELEMENT_EVENT_SPOOLED_DISK_NOT_AVAILABLE</td>
+ <td>
+ The element was pushed out of the memory store,
+ and there is not a disk store available for the
+ region.
+ </td>
+ </tr>
+ <tr>
+ <td>ELEMENT_EVENT_SPOOLED_NOT_ALLOWED</td>
+ <td>
+ The element was pushed out of the memory store,
+ there is a disk store available for the region,
+ but the element is marked as not spoolable.
+ </td>
+ </tr>
+ </table>
+ <p>
+ To create an event handler you must implement the
+ org.apache.jcs.engine.control.event.behavior.IElementEventHandler
+ interface. This interface contains only one method:
+ </p>
+ <source>
+ <![CDATA[
+ public void handleElementEvent( IElementEvent event );
+ ]]>
+ </source>
+ <p>
+ The IElementEvent object contains both the event code
+ and the source. The source is the element for which the
+ event occurred. The code is the type of event. If you
+ have an event handler registered, it will be called
+ whenever any event occurs. It is up to the handler to
+ decide what it would like to do for the particular
+ event. Since there are not that many events, this does
+ not create too much activity. Also, the event handling
+ is done asynchronously. Events are added to an event
+ queue and processed by background threads.
+ </p>
+ <p>
+ Once you have an IElementEventHandler implementation,
+ you can attach it to an element via the Element
+ Attributes. You can either add it to the element
+ attributes when you put an item into the cache, add it
+ to the attributes of an item that exist in the cache
+ (which just results in a re-put), or add the event
+ handler to the default element attributes for a region.
+ If you add it to the default attributes, then all
+ elements subsequently added to the region that do not
+ define their own element attributes will be assigned the
+ default event handlers.
+ </p>
+ <source>
+ <![CDATA[
+ JCS jcs = JCS.getInstance( "myregion" );
+
+ . . .
+
+ MyEventHandler meh = new MyEventHandler();
+
+ // jcs.getDefaultElementAttributes returns a copy not a reference
+ IElementAttributes attributes = jcs.getDefaultElementAttributes();
+ attributes.addElementEventHandler( meh );
+ jcs.put( "key", "data", attributes );
+ ]]>
+ </source>
+ <p>
+ Here is how to setup an event handler as a default
+ setting for a region:
+ </p>
+ <source>
+ <![CDATA[
+ JCS jcs = JCS.getInstance( "myregion" );
+
+ . . .
+
+ MyEventHandler meh = new MyEventHandler();
+
+ // this should add the event handler to all items as
+ //they are created.
+ // jcs.getDefaultElementAttributes returns a copy not a reference
+ IElementAttributes attributes = jcs.getDefaultElementAttributes();
+ attributes.addElementEventHandler( meh );
+ jcs.setDefaultElementAttributes( attributes );
+ ]]>
+ </source>
+
+ </section>
+ </body>
+</document>
Modified: jakarta/jcs/trunk/xdocs/IndexedDiskAuxCache.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/IndexedDiskAuxCache.xml?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/xdocs/IndexedDiskAuxCache.xml (original)
+++ jakarta/jcs/trunk/xdocs/IndexedDiskAuxCache.xml Thu May 10 09:03:42 2007
@@ -1,4 +1,22 @@
<?xml version="1.0"?>
+<!--
+ 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.
+-->
<document>
<properties>
@@ -183,7 +201,7 @@
parameters.
</p>
<source>
- <![CDATA[
+ <![CDATA[
##############################################################
##### Default Region Configuration
jcs.default=DC
@@ -232,7 +250,7 @@
the file.
</p>
<source>
- <![CDATA[
+ <![CDATA[
##############################################################
################## DEFAULT CACHE REGION #####################
# sets the default aux value for any non configured caches
Modified: jakarta/jcs/trunk/xdocs/IndexedDiskCacheProperties.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/IndexedDiskCacheProperties.xml?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/xdocs/IndexedDiskCacheProperties.xml (original)
+++ jakarta/jcs/trunk/xdocs/IndexedDiskCacheProperties.xml Thu May 10 09:03:42 2007
@@ -1,184 +1,202 @@
-<?xml version="1.0"?>
-
-<document>
- <properties>
- <title>Indexed Disk Cache Configuration</title>
- <author email="ASmuts@apache.org">Aaron Smuts</author>
- </properties>
-
- <body>
- <section name="Indexed Disk Auxiliary Cache Configuration">
-
- <p>
- The following properties apply to the Indexed Disk Cache
- plugin.
- </p>
-
- <subsection name="Indexed Disk Configuration Properties">
- <table>
- <tr>
- <th>Property</th>
- <th>Description</th>
- <th>Required</th>
- <th>Default Value</th>
- </tr>
- <tr>
- <td>DiskPath</td>
- <td>
- The directory where the disk cache should
- write its files.
- </td>
- <td>Y</td>
- <td>n/a</td>
- </tr>
- <tr>
- <td>MaxPurgatorySize</td>
- <td>
- The maximum number of items allowed in the
- queue of items to be written to disk.
- </td>
- <td>N</td>
- <td>5000</td>
- </tr>
- <tr>
- <td>MaxKeySize</td>
- <td>
- The maximum number of keys that the indexed
- disk cache can have. Since the keys are
- stored in memory, you may want to limit this
- number to something reasonable. The default
- is a bit small.
- </td>
- <td>N</td>
- <td>5000</td>
- </tr>
- <tr>
- <td>OptimizeAtRemoveCount</td>
- <td>
- At how many removes should the cache try to
- defragment the data file. Since we recycle
- empty spots, defragmentation is usually not
- needed. To prevent the cache from
- defragmenting the data file, you can set
- this to -1. This is the default value.
- </td>
- <td>N</td>
- <td>-1</td>
- </tr>
- <tr>
- <td>OptimizeOnShutdown</td>
- <td>
- By default the Indexed Disk Cache will
- optimize on shutdown if the free data size
- is greater than 0. If you want to prevent
- this behavior, you can set this parameter to
- false.
- </td>
- <td>N</td>
- <td>true</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">
- <source>
- <![CDATA[
-jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
-jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
-jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/indexed-disk-cache
-jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000
-jcs.auxiliary.DC.attributes.MaxKeySize=10000
-jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
-jcs.auxiliary.DC.attributes.OptimizeOnShutdown=true
-jcs.auxiliary.DC.attributes.MaxRecycleBinSize=7500
- ]]>
- </source>
- </subsection>
-
- <subsection name="Indexed Disk Event Queue Configuration">
-
- <table>
- <tr>
- <th>Property</th>
- <th>Description</th>
- <th>Required</th>
- <th>Default Value</th>
- </tr>
- <tr>
- <td>EventQueueType</td>
- <td>
- This should be either SINGLE or POOLED. By
- default the single style pool is used. The
- single style pool uses a single thread per
- event queue. That thread is killed whenever
- the queue is inactive for 30 seconds. Since
- the disk cache uses an event queue for every
- region, if you have many regions and they
- are all active, you will be using many
- threads. To limit the number of threads, you
- can configure the disk cache to use the
- pooled event queue. Using more threads than
- regions will not add any benefit for the
- indexed disk cache, since only one thread
- can read or write at a time for a single
- region.
- </td>
- <td>N</td>
- <td>SINGLE</td>
- </tr>
- <tr>
- <td>EventQueuePoolName</td>
- <td>
- This is the name of the pool to use. It is
- required if you choose the POOLED event
- queue type, otherwise it is ignored.
- </td>
- <td>Y</td>
- <td>n/a</td>
- </tr>
- </table>
- </subsection>
-
- <subsection
- name="Example Configuration Using Thread Pool">
- <source>
- <![CDATA[
-jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
-jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
-jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/indexed-disk-cache
-jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000
-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
-
-# Disk Cache pool
-thread_pool.disk_cache_event_queue.boundarySize=50
-thread_pool.disk_cache_event_queue.useBoundary=true
-thread_pool.disk_cache_event_queue.maximumPoolSize=15
-thread_pool.disk_cache_event_queue.minimumPoolSize=1
-thread_pool.disk_cache_event_queue.keepAliveTime=3500
-thread_pool.disk_cache_event_queue.startUpSize=1
- ]]>
- </source>
- </subsection>
-
-
- </section>
- </body>
-</document>
\ No newline at end of file
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<document>
+ <properties>
+ <title>Indexed Disk Cache Configuration</title>
+ <author email="ASmuts@apache.org">Aaron Smuts</author>
+ </properties>
+
+ <body>
+ <section name="Indexed Disk Auxiliary Cache Configuration">
+
+ <p>
+ The following properties apply to the Indexed Disk Cache
+ plugin.
+ </p>
+
+ <subsection name="Indexed Disk Configuration Properties">
+ <table>
+ <tr>
+ <th>Property</th>
+ <th>Description</th>
+ <th>Required</th>
+ <th>Default Value</th>
+ </tr>
+ <tr>
+ <td>DiskPath</td>
+ <td>
+ The directory where the disk cache should
+ write its files.
+ </td>
+ <td>Y</td>
+ <td>n/a</td>
+ </tr>
+ <tr>
+ <td>MaxPurgatorySize</td>
+ <td>
+ The maximum number of items allowed in the
+ queue of items to be written to disk.
+ </td>
+ <td>N</td>
+ <td>5000</td>
+ </tr>
+ <tr>
+ <td>MaxKeySize</td>
+ <td>
+ The maximum number of keys that the indexed
+ disk cache can have. Since the keys are
+ stored in memory, you may want to limit this
+ number to something reasonable. The default
+ is a bit small.
+ </td>
+ <td>N</td>
+ <td>5000</td>
+ </tr>
+ <tr>
+ <td>OptimizeAtRemoveCount</td>
+ <td>
+ At how many removes should the cache try to
+ defragment the data file. Since we recycle
+ empty spots, defragmentation is usually not
+ needed. To prevent the cache from
+ defragmenting the data file, you can set
+ this to -1. This is the default value.
+ </td>
+ <td>N</td>
+ <td>-1</td>
+ </tr>
+ <tr>
+ <td>OptimizeOnShutdown</td>
+ <td>
+ By default the Indexed Disk Cache will
+ optimize on shutdown if the free data size
+ is greater than 0. If you want to prevent
+ this behavior, you can set this parameter to
+ false.
+ </td>
+ <td>N</td>
+ <td>true</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">
+ <source>
+ <![CDATA[
+jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
+jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
+jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/indexed-disk-cache
+jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000
+jcs.auxiliary.DC.attributes.MaxKeySize=10000
+jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
+jcs.auxiliary.DC.attributes.OptimizeOnShutdown=true
+jcs.auxiliary.DC.attributes.MaxRecycleBinSize=7500
+ ]]>
+ </source>
+ </subsection>
+
+ <subsection name="Indexed Disk Event Queue Configuration">
+
+ <table>
+ <tr>
+ <th>Property</th>
+ <th>Description</th>
+ <th>Required</th>
+ <th>Default Value</th>
+ </tr>
+ <tr>
+ <td>EventQueueType</td>
+ <td>
+ This should be either SINGLE or POOLED. By
+ default the single style pool is used. The
+ single style pool uses a single thread per
+ event queue. That thread is killed whenever
+ the queue is inactive for 30 seconds. Since
+ the disk cache uses an event queue for every
+ region, if you have many regions and they
+ are all active, you will be using many
+ threads. To limit the number of threads, you
+ can configure the disk cache to use the
+ pooled event queue. Using more threads than
+ regions will not add any benefit for the
+ indexed disk cache, since only one thread
+ can read or write at a time for a single
+ region.
+ </td>
+ <td>N</td>
+ <td>SINGLE</td>
+ </tr>
+ <tr>
+ <td>EventQueuePoolName</td>
+ <td>
+ This is the name of the pool to use. It is
+ required if you choose the POOLED event
+ queue type, otherwise it is ignored.
+ </td>
+ <td>Y</td>
+ <td>n/a</td>
+ </tr>
+ </table>
+ </subsection>
+
+ <subsection
+ name="Example Configuration Using Thread Pool">
+ <source>
+ <![CDATA[
+jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
+jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
+jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/indexed-disk-cache
+jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000
+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
+
+# Disk Cache pool
+thread_pool.disk_cache_event_queue.boundarySize=50
+thread_pool.disk_cache_event_queue.useBoundary=true
+thread_pool.disk_cache_event_queue.maximumPoolSize=15
+thread_pool.disk_cache_event_queue.minimumPoolSize=1
+thread_pool.disk_cache_event_queue.keepAliveTime=3500
+thread_pool.disk_cache_event_queue.startUpSize=1
+ ]]>
+ </source>
+ </subsection>
+
+
+ </section>
+ </body>
+</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org