spring-context

org.springframework.scheduling.concurrent
Class ForkJoinPoolFactoryBean

java.lang.Object
  extended by org.springframework.scheduling.concurrent.ForkJoinPoolFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<java.util.concurrent.ForkJoinPool>, org.springframework.beans.factory.InitializingBean

public class ForkJoinPoolFactoryBean
extends java.lang.Object
implements org.springframework.beans.factory.FactoryBean<java.util.concurrent.ForkJoinPool>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

A Spring FactoryBean that builds and exposes a preconfigured ForkJoinPool. May be used on Java 7 as well as on Java 6 with jsr166.jar on the classpath (ideally on the VM bootstrap classpath).

For details on the ForkJoinPool API and its use with RecursiveActions, see the JDK 7 javadoc.

jsr166.jar, containing java.util.concurrent updates for Java 6, can be obtained from the concurrency interest website.

Since:
3.1
Author:
Juergen Hoeller

Constructor Summary
ForkJoinPoolFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 java.util.concurrent.ForkJoinPool getObject()
           
 java.lang.Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setAsyncMode(boolean asyncMode)
          Specify whether to establish a local first-in-first-out scheduling mode for forked tasks that are never joined.
 void setParallelism(int parallelism)
          Specify the parallelism level.
 void setThreadFactory(java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory threadFactory)
          Set the factory for creating new ForkJoinWorkerThreads.
 void setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
          Set the handler for internal worker threads that terminate due to unrecoverable errors encountered while executing tasks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForkJoinPoolFactoryBean

public ForkJoinPoolFactoryBean()
Method Detail

setParallelism

public void setParallelism(int parallelism)
Specify the parallelism level. Default is Runtime.availableProcessors().


setThreadFactory

public void setThreadFactory(java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory threadFactory)
Set the factory for creating new ForkJoinWorkerThreads. Default is ForkJoinPool.defaultForkJoinWorkerThreadFactory.


setUncaughtExceptionHandler

public void setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
Set the handler for internal worker threads that terminate due to unrecoverable errors encountered while executing tasks. Default is none.


setAsyncMode

public void setAsyncMode(boolean asyncMode)
Specify whether to establish a local first-in-first-out scheduling mode for forked tasks that are never joined. This mode (asyncMode = true) may be more appropriate than the default locally stack-based mode in applications in which worker threads only process event-style asynchronous tasks. Default is false.


afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

getObject

public java.util.concurrent.ForkJoinPool getObject()
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean<java.util.concurrent.ForkJoinPool>

getObjectType

public java.lang.Class<?> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<java.util.concurrent.ForkJoinPool>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean<java.util.concurrent.ForkJoinPool>

destroy

public void destroy()
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean

spring-context