Java Doc for AbstractExecutable.java in  » Web-Server » JicarillaHTTP » org » jicarilla » lang » 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 » Web Server » JicarillaHTTP » org.jicarilla.lang 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jicarilla.lang.AbstractActive
      org.jicarilla.lang.AbstractExecutable

All known Subclasses:   org.jicarilla.plumbing.Connector,  org.jicarilla.lang.AbstractAsyncEnabled,
AbstractExecutable
abstract public class AbstractExecutable extends AbstractActive (Code)

Provides generic support for the 'inner worker thread' coding pattern where child classes are shielded from most of the processing mechanics. Subclasses will need to implement AbstractExecutable.work() , which will be called from the inner worker thread.

Exactly how often or in what kind of thread configuration the work() method can be customized by passing in a custom Executor . If none is provided, a single new thread will be created. The worker passed to this executor will never Thread.sleep(long) , but it will Thread.yield after each call to work().

Note that this class is Active , and extends from AbstractActive . As such, you should not override the AbstractExecutable.initialize() nor the AbstractExecutable.dispose() methods, but only ever override AbstractExecutable.doInitialize() and/or AbstractExecutable.doDispose() . When you do, make sure to call the overridden methods as well.


author:
   Leo Simons
version:
   $Id: AbstractExecutable.java,v 1.1 2004/03/23 13:37:57 lsimons Exp $

Inner Class :protected class Worker implements Runnable

Field Summary
protected  Executorm_executor
     The executor that will execute our worker.
protected  ExceptionListenerm_listener
     The recipient of errors thrown by work().
protected  Workerm_worker
     The worker that calls work().

Constructor Summary
public  AbstractExecutable()
     Create a new instance that uses the ThreadedExecutor .
public  AbstractExecutable(Executor executor)
     Create a new instance that uses the provided executor.
public  AbstractExecutable(Executor executor, ExceptionListener listener)
     Create a new instance that uses the provided executor and sends all exceptions thrown by @{link #work()} to the provided listener.

Method Summary
protected  voiddoDispose()
     Stops the worker and disposes of all state.
protected  voiddoInitialize()
     Creates a new worker and tells the executor to execute it.
protected  voidwork()
     This method is called whenever your 'executable' class should perform 'a unit' of work.

Field Detail
m_executor
protected Executor m_executor(Code)
The executor that will execute our worker.



m_listener
protected ExceptionListener m_listener(Code)
The recipient of errors thrown by work().



m_worker
protected Worker m_worker(Code)
The worker that calls work().




Constructor Detail
AbstractExecutable
public AbstractExecutable()(Code)
Create a new instance that uses the ThreadedExecutor .



AbstractExecutable
public AbstractExecutable(Executor executor)(Code)
Create a new instance that uses the provided executor.
Parameters:
  executor - the executor to use.



AbstractExecutable
public AbstractExecutable(Executor executor, ExceptionListener listener)(Code)
Create a new instance that uses the provided executor and sends all exceptions thrown by @{link #work()} to the provided listener.
Parameters:
  executor - the executor to use.
Parameters:
  listener - the listener to send exceptions to.May be null.




Method Detail
doDispose
protected void doDispose()(Code)
Stops the worker and disposes of all state.



doInitialize
protected void doInitialize() throws InterruptedException, Throwable(Code)
Creates a new worker and tells the executor to execute it.
throws:
  InterruptedException - if the current thread has beenjava.lang.Thread.interrupted



work
protected void work() throws Throwable(Code)
This method is called whenever your 'executable' class should perform 'a unit' of work. Override it in subclasses to do some meaningful stuff. Also note that a call to Thread.yield() is made every time this method returns, so you don't generally need to call yield() yourself...unless you're doing a pretty intensive operation.
throws:
  Throwable - if any problem occurs. The exception will be fed toany exceptionlisteners that may exist.



Fields inherited from org.jicarilla.lang.AbstractActive
protected boolean m_running(Code)(Java Doc)
protected boolean m_stopped(Code)(Java Doc)

Methods inherited from org.jicarilla.lang.AbstractActive
final protected synchronized void checkActive()(Code)(Java Doc)
final public synchronized void dispose() throws Throwable(Code)(Java Doc)
protected void doDispose() throws Throwable(Code)(Java Doc)
protected void doInitialize() throws Throwable(Code)(Java Doc)
final public synchronized void initialize() throws Throwable(Code)(Java Doc)
final protected synchronized boolean isActive()(Code)(Java Doc)
final protected synchronized boolean isDisposed()(Code)(Java Doc)
final protected synchronized boolean isInitialized()(Code)(Java Doc)
final protected synchronized void lazyInitialization() throws Throwable(Code)(Java Doc)

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.