Source Code Cross Referenced for Condition.java in  » Workflow-Engines » Dalma » dalma » 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 » Workflow Engines » Dalma » dalma 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package dalma;
002:
003:        import dalma.spi.ConditionListener;
004:
005:        import java.io.Serializable;
006:
007:        /**
008:         * TODO.
009:         *
010:         * Derived by endpoint specific implementation to capture endpoint-specific information.
011:         * Intances created by a {@link EndPoint} in a endPoint specific way.
012:         *
013:         * <p>
014:         * Condition stays in memory even when the continuation is persisted to a disk,
015:         * to wait for the activation event.
016:         *
017:         * <p>
018:         * Condition is serialized as a part of the conversation, allowing conversation
019:         * to requeue when the engine is loaded from a file.
020:         *
021:         * @author Kohsuke Kawaguchi
022:         */
023:        public abstract class Condition<T> implements  Serializable {
024:            /**
025:             * Receives activation event.
026:             */
027:            private ConditionListener owner;
028:
029:            /**
030:             * Activation value from this dock.
031:             *
032:             * Transient because this field is always null when a conversation is serialized.
033:             */
034:            private transient T returnValue;
035:
036:            /**
037:             * Set to true once this {@link Condition} becomes active.
038:             */
039:            private boolean isActive = false;
040:
041:            protected Condition() {
042:            }
043:
044:            public final ConditionListener getOwner() {
045:                return owner;
046:            }
047:
048:            public final boolean isActive() {
049:                return isActive;
050:            }
051:
052:            public final void park(ConditionListener owner) {
053:                this .owner = owner;
054:                onParked();
055:            }
056:
057:            /**
058:             * Called after the conversation is parked on this dock.
059:             *
060:             * {@link #owner}!=null guaranteed. Typically used to queue
061:             * this dock.
062:             * TODO: should this be the same with onLoad?
063:             *
064:             * TODO: error handling semantics. what happens if the park fails?
065:             */
066:            public abstract void onParked();
067:
068:            /**
069:             * Called when a {@link Conversation} parking on this endPoint is
070:             * {@link Conversation#remove() removed}.
071:             *
072:             * <p>
073:             * The implementation is expected to remove this conversation
074:             * from any queue it maintains. If the conversation isn't parked,
075:             * throw an assertion faillure, as it's a bug in the dalma engine.
076:             */
077:            public abstract void interrupt();
078:
079:            /**
080:             * Called after this dock is restored from disk.
081:             *
082:             * <p>
083:             * Typically used to requeue this object.
084:             * This happens while the conversation is being restored from the disk.
085:             *
086:             * <p>
087:             * Note that a {@link Condition} may be serialized even after
088:             * it gets activated (for example, the conversation may be forced
089:             * to persist before a fiber that owns it gets a chance to be executed.)
090:             */
091:            // TODO: update to work with the new semantics
092:            public abstract void onLoad();
093:
094:            /**
095:             * Resumes the conversation parked on this dock.
096:             * Typically invoked by an end point when the conversation should be resumed.
097:             *
098:             * <p>
099:             * Note that the resumed conversation may start executed even before this method
100:             * returns.
101:             */
102:            public final void activate(T retVal) {
103:                synchronized (this ) {
104:                    if (isActive)
105:                        throw new IllegalStateException(
106:                                "condition is already active : " + toString());
107:                    isActive = true;
108:                }
109:                assert owner != null;
110:                synchronized (this ) {
111:                    this .returnValue = retVal;
112:                }
113:                // ((ConversationImpl)conv).resume(this);
114:                owner.onActivated(this );
115:            }
116:
117:            public final synchronized T getReturnValue() {
118:                assert isActive;
119:                return returnValue;
120:            }
121:
122:            private static final long serialVersionUID = 1L;
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.