Java Doc for Task.java in  » IDE-Netbeans » openide » org » openide » 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 » IDE Netbeans » openide » org.openide.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.openide.util.Task

All known Subclasses:   org.openide.loaders.FolderInstance,  org.openide.execution.ExecutorTask,  org.openide.awt.AWTTask,
Task
public class Task extends Object implements Runnable(Code)
A task that may be executed in a separate thread and permits examination of its status. Other threads can check if it is finished or wait for it to finish.

For example:

 Runnable r = new Runnable () {
 public void run () {
 // do something
 }
 };
 Task task = new Task (r);
 RequestProcessor.postRequest (task);
 

In a different thread one can then test task.isFinished () or wait for it with task.waitFinished ().
author:
   Jaroslav Tulach



Field Summary
final public static  TaskEMPTY
     Dummy task which is already finished.
final  Runnablerun
    

Constructor Summary
public  Task(Runnable run)
     Create a new task.
protected  Task()
     Constructor for subclasses that wants to control whole execution itself.

Method Summary
public synchronized  voidaddTaskListener(TaskListener l)
     Add a listener to the task.
 Stringdebug()
     Reveal the identity of the worker runnable.
final public  booleanisFinished()
     Test whether the task has finished running.
final protected  voidnotifyFinished()
     Notify all waiters that this task has finished.
final protected  voidnotifyRunning()
     Changes the state of the task to be running.
public synchronized  voidremoveTaskListener(TaskListener l)
     Remove a listener from the task.
public  voidrun()
     Start the task.
public  StringtoString()
    
public  voidwaitFinished()
     Wait until the task is finished.
public  booleanwaitFinished(long milliseconds)
     Wait until the task is finished, but only a given time.

Field Detail
EMPTY
final public static Task EMPTY(Code)
Dummy task which is already finished.



run
final Runnable run(Code)
what to run




Constructor Detail
Task
public Task(Runnable run)(Code)
Create a new task. The runnable should provide its own error-handling, as by default thrown exceptions are simply logged and not rethrown.
Parameters:
  run - runnable to run that computes the task



Task
protected Task()(Code)
Constructor for subclasses that wants to control whole execution itself.
since:
   1.5




Method Detail
addTaskListener
public synchronized void addTaskListener(TaskListener l)(Code)
Add a listener to the task.
Parameters:
  l - the listener to add



debug
String debug()(Code)
Reveal the identity of the worker runnable. Used for debugging from RequestProcessor.



isFinished
final public boolean isFinished()(Code)
Test whether the task has finished running. true if so



notifyFinished
final protected void notifyFinished()(Code)
Notify all waiters that this task has finished.
See Also:   Task.run



notifyRunning
final protected void notifyRunning()(Code)
Changes the state of the task to be running. Any call after this one and before notifyFinished to waitFinished blocks.
since:
   1.5



removeTaskListener
public synchronized void removeTaskListener(TaskListener l)(Code)
Remove a listener from the task.
Parameters:
  l - the listener to remove



run
public void run()(Code)
Start the task. When it finishes (even with an exception) it calls Task.notifyFinished . Subclasses may override this method, but they then need to call Task.notifyFinished explicitly.

Note that this call runs synchronously, but typically the creator of the task will call this method in a separate thread.




toString
public String toString()(Code)



waitFinished
public void waitFinished()(Code)
Wait until the task is finished. Changed not to be final in version 1.5



waitFinished
public boolean waitFinished(long milliseconds) throws InterruptedException(Code)
Wait until the task is finished, but only a given time.
Parameters:
  milliseconds - time in milliseconds to wait for the result
exception:
  InterruptedException - when the waiting has been interrupted true if the task is really finished, or false if the time outhas been exceeded
since:
   5.0



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.