Java Doc for ThreadPoolTaskExecutor.java in  » J2EE » spring-framework-2.5 » org » springframework » scheduling » concurrent » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.5 » org.springframework.scheduling.concurrent 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor

ThreadPoolTaskExecutor
public class ThreadPoolTaskExecutor implements SchedulingTaskExecutor,Executor,BeanNameAware,InitializingBean,DisposableBean(Code)
JavaBean that allows for configuring a JDK 1.5 java.util.concurrent.ThreadPoolExecutor in bean style (through its "corePoolSize", "maxPoolSize", "keepAliveSeconds", "queueCapacity" properties), exposing it as a Spring org.springframework.core.task.TaskExecutor . This is an alternative to configuring a ThreadPoolExecutor instance directly using constructor injection, with a separate ConcurrentTaskExecutor adapter wrapping it.

For any custom needs, in particular for defining a java.util.concurrent.ScheduledThreadPoolExecutor , it is recommended to use a straight definition of the Executor instance or a factory method definition that points to the JDK 1.5 java.util.concurrent.Executors class. To expose such a raw Executor as a Spring org.springframework.core.task.TaskExecutor , simply wrap it with a ConcurrentTaskExecutor adapter.

NOTE: This class implements Spring's org.springframework.core.task.TaskExecutor interface as well as the JDK 1.5 java.util.concurrent.Executor interface, with the former being the primary interface, the other just serving as secondary convenience. For this reason, the exception handling follows the TaskExecutor contract rather than the Executor contract, in particular regarding the org.springframework.core.task.TaskRejectedException .
author:
   Juergen Hoeller
since:
   2.0
See Also:   org.springframework.core.task.TaskExecutor
See Also:   java.util.concurrent.Executor
See Also:   java.util.concurrent.ThreadPoolExecutor
See Also:   java.util.concurrent.ScheduledThreadPoolExecutor
See Also:   java.util.concurrent.Executors
See Also:   ConcurrentTaskExecutor



Field Summary
final protected  Loglogger
    


Method Summary
public  voidafterPropertiesSet()
     Calls initialize() after the container applied all property values.
protected  BlockingQueuecreateQueue(int queueCapacity)
     Create the BlockingQueue to use for the ThreadPoolExecutor.
public  voiddestroy()
     Calls shutdown when the BeanFactory destroys the task executor instance.
public  voidexecute(Runnable task)
     Implementation of both the JDK 1.5 Executor interface and the Spring TaskExecutor interface, delegating to the ThreadPoolExecutor instance.
public  intgetActiveCount()
     Return the number of currently active threads.
public  intgetCorePoolSize()
     Return the ThreadPoolExecutor's core pool size.
public  intgetKeepAliveSeconds()
     Return the ThreadPoolExecutor's keep-alive seconds.
public  intgetMaxPoolSize()
     Return the ThreadPoolExecutor's maximum pool size.
public  intgetPoolSize()
     Return the current pool size.
public  ThreadPoolExecutorgetThreadPoolExecutor()
     Return the underlying ThreadPoolExecutor for native access.
public  voidinitialize()
     Creates the BlockingQueue and the ThreadPoolExecutor.
public  booleanprefersShortLivedTasks()
     This task executor prefers short-lived work units.
public  voidsetBeanName(String name)
    
public  voidsetCorePoolSize(int corePoolSize)
     Set the ThreadPoolExecutor's core pool size.
public  voidsetKeepAliveSeconds(int keepAliveSeconds)
     Set the ThreadPoolExecutor's keep-alive seconds.
public  voidsetMaxPoolSize(int maxPoolSize)
     Set the ThreadPoolExecutor's maximum pool size.
public  voidsetQueueCapacity(int queueCapacity)
     Set the capacity for the ThreadPoolExecutor's BlockingQueue.
public  voidsetRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler)
     Set the RejectedExecutionHandler to use for the ThreadPoolExecutor.
public  voidsetThreadFactory(ThreadFactory threadFactory)
     Set the ThreadFactory to use for the ThreadPoolExecutor's thread pool.
public  voidshutdown()
     Perform a shutdown on the ThreadPoolExecutor.

Field Detail
logger
final protected Log logger(Code)





Method Detail
afterPropertiesSet
public void afterPropertiesSet()(Code)
Calls initialize() after the container applied all property values.
See Also:   ThreadPoolTaskExecutor.initialize()



createQueue
protected BlockingQueue createQueue(int queueCapacity)(Code)
Create the BlockingQueue to use for the ThreadPoolExecutor.

A LinkedBlockingQueue instance will be created for a positive capacity value; a SynchronousQueue else.
Parameters:
  queueCapacity - the specified queue capacity the BlockingQueue instance
See Also:   java.util.concurrent.LinkedBlockingQueue
See Also:   java.util.concurrent.SynchronousQueue




destroy
public void destroy()(Code)
Calls shutdown when the BeanFactory destroys the task executor instance.
See Also:   ThreadPoolTaskExecutor.shutdown()



execute
public void execute(Runnable task)(Code)
Implementation of both the JDK 1.5 Executor interface and the Spring TaskExecutor interface, delegating to the ThreadPoolExecutor instance.
See Also:   java.util.concurrent.Executor.execute(Runnable)
See Also:   org.springframework.core.task.TaskExecutor.execute(Runnable)



getActiveCount
public int getActiveCount()(Code)
Return the number of currently active threads.
See Also:   java.util.concurrent.ThreadPoolExecutor.getActiveCount



getCorePoolSize
public int getCorePoolSize()(Code)
Return the ThreadPoolExecutor's core pool size.



getKeepAliveSeconds
public int getKeepAliveSeconds()(Code)
Return the ThreadPoolExecutor's keep-alive seconds.



getMaxPoolSize
public int getMaxPoolSize()(Code)
Return the ThreadPoolExecutor's maximum pool size.



getPoolSize
public int getPoolSize()(Code)
Return the current pool size.
See Also:   java.util.concurrent.ThreadPoolExecutor.getPoolSize



getThreadPoolExecutor
public ThreadPoolExecutor getThreadPoolExecutor() throws IllegalStateException(Code)
Return the underlying ThreadPoolExecutor for native access. the underlying ThreadPoolExecutor (never null)
throws:
  IllegalStateException - if the ThreadPoolTaskExecutor hasn't been initialized yet



initialize
public void initialize()(Code)
Creates the BlockingQueue and the ThreadPoolExecutor.
See Also:   ThreadPoolTaskExecutor.createQueue



prefersShortLivedTasks
public boolean prefersShortLivedTasks()(Code)
This task executor prefers short-lived work units.



setBeanName
public void setBeanName(String name)(Code)



setCorePoolSize
public void setCorePoolSize(int corePoolSize)(Code)
Set the ThreadPoolExecutor's core pool size. Default is 1.

This setting can be modified at runtime, for example through JMX.




setKeepAliveSeconds
public void setKeepAliveSeconds(int keepAliveSeconds)(Code)
Set the ThreadPoolExecutor's keep-alive seconds. Default is 60.

This setting can be modified at runtime, for example through JMX.




setMaxPoolSize
public void setMaxPoolSize(int maxPoolSize)(Code)
Set the ThreadPoolExecutor's maximum pool size. Default is Integer.MAX_VALUE.

This setting can be modified at runtime, for example through JMX.




setQueueCapacity
public void setQueueCapacity(int queueCapacity)(Code)
Set the capacity for the ThreadPoolExecutor's BlockingQueue. Default is Integer.MAX_VALUE.

Any positive value will lead to a LinkedBlockingQueue instance; any other value will lead to a SynchronousQueue instance.
See Also:   java.util.concurrent.LinkedBlockingQueue
See Also:   java.util.concurrent.SynchronousQueue




setRejectedExecutionHandler
public void setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler)(Code)
Set the RejectedExecutionHandler to use for the ThreadPoolExecutor. Default is the ThreadPoolExecutor's default abort policy.
See Also:   java.util.concurrent.ThreadPoolExecutor.AbortPolicy



setThreadFactory
public void setThreadFactory(ThreadFactory threadFactory)(Code)
Set the ThreadFactory to use for the ThreadPoolExecutor's thread pool. Default is the ThreadPoolExecutor's default thread factory.
See Also:   java.util.concurrent.Executors.defaultThreadFactory



shutdown
public void shutdown()(Code)
Perform a shutdown on the ThreadPoolExecutor.
See Also:   java.util.concurrent.ThreadPoolExecutor.shutdown



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.