org.apache.jackrabbit.core.query.lucene
Class DynamicPooledExecutor

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.DynamicPooledExecutor

public class DynamicPooledExecutor
extends Object

DynamicPooledExecutor implements an executor, which dynamically adjusts its maximum number of threads according to the number of available processors returned by Runtime.availableProcessors().


Nested Class Summary
static interface DynamicPooledExecutor.Command
           
static class DynamicPooledExecutor.Result
           
 
Constructor Summary
DynamicPooledExecutor()
          Creates a new DynamicPooledExecutor.
 
Method Summary
 void execute(Runnable command)
          Executes the given command.
 DynamicPooledExecutor.Result[] executeAndWait(DynamicPooledExecutor.Command[] commands)
          Executes a set of commands and waits until all commands have been executed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicPooledExecutor

public DynamicPooledExecutor()
Creates a new DynamicPooledExecutor.

Method Detail

execute

public void execute(Runnable command)
Executes the given command. This method will block if all threads in the pool are busy and return only when the command has been accepted. Care must be taken, that no deadlock occurs when multiple commands are scheduled for execution. In general commands should not depend on the execution of other commands!

Parameters:
command - the command to execute.

executeAndWait

public DynamicPooledExecutor.Result[] executeAndWait(DynamicPooledExecutor.Command[] commands)
Executes a set of commands and waits until all commands have been executed. The results of the commands are returned in the same order as the commands.

Parameters:
commands - the commands to execute.
Returns:
the results.


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.