Java Doc for Schedulable.java in  » Science » Cougaar12_4 » org » cougaar » core » thread » 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 » Science » Cougaar12_4 » org.cougaar.core.thread 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.cougaar.core.thread.Schedulable

All known Subclasses:   org.cougaar.core.thread.TrivialSchedulable,  org.cougaar.core.thread.SchedulableObject,
Schedulable
public interface Schedulable (Code)
A Schedulable is an API provided by the org.cougaar.core.service.ThreadService that takes the place of standard Java java.lang.Thread s and java.util.TimerTask s.

Aside from a few special internal cases, all Threads and Tasks in Cougaar should come from the ThreadService in the form of Schedulables. To treat a Schedulable like a Thread, use the start method. To treat a Schedulable like a TimerTask, use the schedule methods. The ThreadService is the only source of usable Schedulables.


Inner Class :interface SuspendCallback



Method Summary
 booleancancel()
     Cancelling a Schedulable will prevent starting if it's currently queued or from restarting if it was scheduled to do so.
 voidcancelTimer()
    
 StringgetBlockingExcuse()
    
 intgetBlockingType()
    
 ObjectgetConsumer()
     Returns the requestor for whom the ThreadService made this Schedulable.
 intgetLane()
    
 StringgetName()
    
 intgetState()
     Returns the current state of the Schedulable.
 longgetTimestamp()
    
 voidresume()
    
 voidschedule(long delay)
     The following methods behave more or less as they on TimerTasks, except that the schedule methods can be called more than once.
 voidschedule(long delay, long interval)
    
 voidscheduleAtFixedRate(long delay, long interval)
    
 voidstart()
     Starting a Schedulable is conceptually the same as starting a Java Thread.

Note these differences:

  1. The java.lang.Runnable.run method invoked due to the Schedulable.start() should return promptly, to free the pooled Thread for use by other waiting Schedulables.
  2. If no thread resources are available, the Schedulable will be queued instead of running right away.
 voidsuspend(SuspendCallback callback)
     Like Schedulable.cancel but with two differences: the Schedulable can be resumed later, and a special callback is invoked when the current run finishes.



Method Detail
cancel
boolean cancel()(Code)
Cancelling a Schedulable will prevent starting if it's currently queued or from restarting if it was scheduled to do so. It will not cancel the current run.



cancelTimer
void cancelTimer()(Code)



getBlockingExcuse
String getBlockingExcuse()(Code)



getBlockingType
int getBlockingType()(Code)



getConsumer
Object getConsumer()(Code)
Returns the requestor for whom the ThreadService made this Schedulable.



getLane
int getLane()(Code)
Lane



getName
String getName()(Code)



getState
int getState()(Code)
Returns the current state of the Schedulable. The states are described in CougaarThread .



getTimestamp
long getTimestamp()(Code)
Other status methods, for the ThreadStatusService



resume
void resume()(Code)
Restart after a #suspend).



schedule
void schedule(long delay)(Code)
The following methods behave more or less as they on TimerTasks, except that the schedule methods can be called more than once. In that case, later calls effectively reschedule the Schedulable. Since 'cancel' was already in use, a new method had to be introduced to cancel a scheduled task. Thus 'cancelTimer'.



schedule
void schedule(long delay, long interval)(Code)



scheduleAtFixedRate
void scheduleAtFixedRate(long delay, long interval)(Code)



start
void start()(Code)
Starting a Schedulable is conceptually the same as starting a Java Thread.

Note these differences:

  1. The java.lang.Runnable.run method invoked due to the Schedulable.start() should return promptly, to free the pooled Thread for use by other waiting Schedulables.
  2. If no thread resources are available, the Schedulable will be queued instead of running right away. It will only run when enough resources have become available for it to reach the head of the queue.
  3. If the Schedulable is running at the time of the call, it will restart itself after the current run finishes (unless it's cancelled in the meantime). The java.lang.Runnable.run called by Schedulable.start() is single-threaded.



suspend
void suspend(SuspendCallback callback)(Code)
Like Schedulable.cancel but with two differences: the Schedulable can be resumed later, and a special callback is invoked when the current run finishes.



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