Merged V2.9 to HEAD

9845: Merged V2.2 to V2.9
      9733: Merged V2.1 to V2.2
         9281: Improvements to index AUTO recovery
         9316: Fixed ETWOONE-193: Transactional caches not being cleaned up after rollback (2.1.4 regression)
         9317: Fixed ETWOONE-194: Faster void handling during index tracking
         9365: Improved performance for finding which snapshots have been indexed
         9413: Support to retrieve read/write state of the transaction and ensure Lucene commits are handled last
         9414: ACT-3245: Updating node properties and aspects don't bump the alf_node.version value
         9415: Code cleanup: Removed unnecessary empty methods
         9416: Fixed creation of multiple thread pools
         9417: Full index recovery absorbs indexing exceptions by default
         9418: Added AUTO index recovery option to sample in line with Wiki docs
         9419: ETWOONE-194: Index tracking is too slow
         9420: Fixed ETWOONE-201: Better logging and configurability for RetryingTransactionHelper
         9421: Fixed ETWOONE-202: SPlit person cleanup doesn't break read-only transactions
         9422: Follow up on CHK-3317: Removed use of JDK 1.6 NavigableMap interface
         9423: Fixed unit test after CHK-3317
         9424: More test fixes after CHK-3317
         9425: Ensure that index tracking tests don't run too long.
         9426: Made concurrent reindexing optional.  It is on by default.
         9509: ACT-3539: Mid-transaction locking on Lucene resources
         9547: Multithreaded index tracking startup: Handle previously lagging single-threaded rebuilds


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10592 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-08-30 03:11:18 +00:00
parent 75646b4234
commit 0ac7884d1b
31 changed files with 1934 additions and 536 deletions

View File

@@ -51,11 +51,11 @@ import org.springframework.beans.factory.InitializingBean;
* <li><b>{@link #setKeepAliveTime(int) keepAliveTime}: </b>
* 90 seconds</li>
* <li><b>{@link #setThreadPriority(int) threadPriority}: </b>
* 1 (LOWEST)</li>
* 5 (NORM)</li>
* <li><b>{@link #setThreadDaemon(boolean) threadDaemon}: </b>
* true</li>
* <li><b>{@link #setWorkQueue(BlockingQueue) workQueue}: </b>
* An unbounded <code>LinkedBlockingQueue</code></li>
* <li><b>{@link #setWorkQueueSize(int) workQueueSize}: </b>
* -1 or less (No upper bound)</li>
* <li><b>{@link #setRejectedExecutionHandler(RejectedExecutionHandler) rejectedExecutionHandler: </b>
* <code>ThreadPoolExecutor.CallerRunsPolicy</code></li>
* </ul>
@@ -67,9 +67,9 @@ public class ThreadPoolExecutorFactoryBean implements FactoryBean, InitializingB
private static final int DEFAULT_CORE_POOL_SIZE = 20;
private static final int DEFAULT_MAXIMUM_POOL_SIZE = -1; // -1 is a sign that it must match the core pool size
private static final int DEFAULT_KEEP_ALIVE_TIME = 90; // seconds
private static final int DEFAULT_THREAD_PRIORITY = Thread.MIN_PRIORITY;
private static final int DEFAULT_THREAD_PRIORITY = Thread.NORM_PRIORITY;
private static final boolean DEFAULT_THREAD_DAEMON = Boolean.TRUE;
private static final BlockingQueue<Runnable> DEFAULT_WORK_QUEUE = new LinkedBlockingQueue<Runnable>();
private static final int DEFAULT_WORK_QUEUE_SIZE = -1;
private static final RejectedExecutionHandler DEFAULT_REJECTED_EXECUTION_HANDLER = new ThreadPoolExecutor.CallerRunsPolicy();
private int corePoolSize;
@@ -77,7 +77,7 @@ public class ThreadPoolExecutorFactoryBean implements FactoryBean, InitializingB
private int keepAliveTime;
private int threadPriority;
private boolean threadDaemon;
private BlockingQueue<Runnable> workQueue;
private int workQueueSize;
private RejectedExecutionHandler rejectedExecutionHandler;
/** the instance that will be given out by the factory */
private ThreadPoolExecutor instance;
@@ -92,7 +92,7 @@ public class ThreadPoolExecutorFactoryBean implements FactoryBean, InitializingB
keepAliveTime = DEFAULT_KEEP_ALIVE_TIME;
threadPriority = DEFAULT_THREAD_PRIORITY;
threadDaemon = DEFAULT_THREAD_DAEMON;
workQueue = DEFAULT_WORK_QUEUE;
workQueueSize = DEFAULT_WORK_QUEUE_SIZE;
rejectedExecutionHandler = DEFAULT_REJECTED_EXECUTION_HANDLER;
}
@@ -148,13 +148,15 @@ public class ThreadPoolExecutorFactoryBean implements FactoryBean, InitializingB
}
/**
* The optional queue instance to use
* The maximum number of queued work instances to keep before blocking
* against further adds.
*
* @param workQueue optional queue implementation
* @param size the queue size before blocks, or <b>-1</b> default
* to indicate no upper bound
*/
public void setWorkQueue(BlockingQueue<Runnable> workQueue)
public void setWorkQueueSize(int workQueueSize)
{
this.workQueue = workQueue;
this.workQueueSize = workQueueSize;
}
/**
@@ -181,6 +183,12 @@ public class ThreadPoolExecutorFactoryBean implements FactoryBean, InitializingB
threadFactory.setThreadDaemon(threadDaemon);
threadFactory.setThreadPriority(threadPriority);
if (workQueueSize < 0)
{
workQueueSize = Integer.MAX_VALUE;
}
BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>(workQueueSize);
// construct the instance
instance = new ThreadPoolExecutor(
corePoolSize,
@@ -197,7 +205,7 @@ public class ThreadPoolExecutorFactoryBean implements FactoryBean, InitializingB
*/
public boolean isSingleton()
{
return true;
return false;
}
/**