Java Doc for ThreadPool.java in  » Net » snmp4j » org » snmp4j » util » 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 » Net » snmp4j » org.snmp4j.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.snmp4j.util.ThreadPool

ThreadPool
public class ThreadPool implements WorkerPool(Code)
The ThreadPool provides a pool of a fixed number of threads that are capable to execute tasks that implement the Runnable interface concurrently. The ThreadPool blocks when all threads are busy with tasks and an additional task is added.
author:
   Frank Fock
version:
   1.6
since:
   1.0.2

Inner Class :class TaskManager extends Thread

Field Summary
protected  Stringname
    
protected  booleanrespawnThreads
    
protected volatile  booleanstop
    
protected  VectortaskManagers
    

Constructor Summary
protected  ThreadPool()
    

Method Summary
public synchronized  voidcancel()
     Cancels all threads non-blocking by interrupting them.
public static  ThreadPoolcreate(String name, int size)
     Creates a thread pool with the supplied name and size.
Parameters:
  name - the name prefix for the threads in this pool.
Parameters:
  size - the number of threads in this pool.
public synchronized  voidexecute(WorkerTask task)
     Executes a task on behalf of this thread pool.
public  StringgetName()
     Returns the name of the thread pool.
protected  StringgetTaskManagerName(String prefix, int index)
    
public synchronized  voidinterrupt()
     Interrupts all threads in the pool.
public synchronized  booleanisIdle()
     Checks if all threads of the pool are idle.
public  booleanisRespawnThreads()
     Tests if the threads are respawn (recreates) when they have been stopped or canceled.
public  voidsetRespawnThreads(boolean respawnThreads)
     Specifies whether threads are respawned by this thread pool after they have been stopped or not.
protected  voidsetup(String name, int size)
    
public  voidstop()
     Stops all threads in this thread pool gracefully.
public synchronized  booleantryToExecute(WorkerTask task)
     Tries to execute a task on behalf of this thread pool.

Field Detail
name
protected String name(Code)



respawnThreads
protected boolean respawnThreads(Code)



stop
protected volatile boolean stop(Code)



taskManagers
protected Vector taskManagers(Code)




Constructor Detail
ThreadPool
protected ThreadPool()(Code)




Method Detail
cancel
public synchronized void cancel()(Code)
Cancels all threads non-blocking by interrupting them.



create
public static ThreadPool create(String name, int size)(Code)
Creates a thread pool with the supplied name and size.
Parameters:
  name - the name prefix for the threads in this pool.
Parameters:
  size - the number of threads in this pool. This number also specifies thenumber of concurrent tasks that can be executed with this pool.a ThreadPool instance.



execute
public synchronized void execute(WorkerTask task)(Code)
Executes a task on behalf of this thread pool. If all threads are currently busy, this method call blocks until a thread gets idle again which is when the call returns immediately.
Parameters:
  task - a Runnable to execute.



getName
public String getName()(Code)
Returns the name of the thread pool. the name of this thread pool.



getTaskManagerName
protected String getTaskManagerName(String prefix, int index)(Code)



interrupt
public synchronized void interrupt()(Code)
Interrupts all threads in the pool.
since:
   1.6



isIdle
public synchronized boolean isIdle()(Code)
Checks if all threads of the pool are idle. true if all threads are idle.
since:
   1.6



isRespawnThreads
public boolean isRespawnThreads()(Code)
Tests if the threads are respawn (recreates) when they have been stopped or canceled. true if threads are respawn.



setRespawnThreads
public void setRespawnThreads(boolean respawnThreads)(Code)
Specifies whether threads are respawned by this thread pool after they have been stopped or not. Default is no respawning.
Parameters:
  respawnThreads - if true then threads will be respawn.



setup
protected void setup(String name, int size)(Code)



stop
public void stop()(Code)
Stops all threads in this thread pool gracefully. This method will not return until all threads have been terminated and joined successfully.



tryToExecute
public synchronized boolean tryToExecute(WorkerTask task)(Code)
Tries to execute a task on behalf of this thread pool. If all threads are currently busy, this method returns false. Otherwise the task is executed in background.
Parameters:
  task - a Runnable to execute.true if the task is executing.
since:
   1.6



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.