TechDocs


   Rubrik > Development >

C++
J2EE
Java



    17.02.2011 15:54:39  Development    

Spring - Java 1.5, create a ExecutorService with concurrent.Executors factory methods

This is a short example howto inject a Java 1.5 ExecutorService in Spring. The service has to be created with factory methods of class java.util.Executors. Springs Executor Framework is compatible with all versions of Java an does therefore not support the newest interfaces Callable and Future.
The following lines are for all who want to work with the newest interfaces Callable, Future and Executor of Java 1.5 and higher.

Java code:

ExecutorService concurrentTaskExecutor = Executors.newFixedThreadPool(4);

Create a FixedThreadPool ExecutorService in Spring:



Übersicht