Source Code Cross Referenced for XSSLActionQueue.java in  » XML » activexml » org » xdev » base » xssl » 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 » XML » activexml » org.xdev.base.xssl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on Dec 31, 2003
003:         *
004:         * To change the template for this generated file go to
005:         * Window>Preferences>Java>Code Generation>Code and Comments
006:         */
007:        package org.xdev.base.xssl;
008:
009:        import java.util.ArrayList;
010:        import java.util.HashMap;
011:
012:        import org.xdev.base.xssl.manage.ITransactionFinalizable;
013:
014:        /**
015:         * @author AYegorov
016:         *
017:         * To change the template for this generated type comment go to
018:         * Window>Preferences>Java>Code Generation>Code and Comments
019:         */
020:        public abstract class XSSLActionQueue extends XSSLActionIterator
021:                implements  Runnable, ITransactionFinalizable {
022:            protected ArrayList queue = null;
023:
024:            protected Thread queueThread = null;
025:
026:            private boolean interrupted;
027:            private boolean running;
028:
029:            private XSSLActionQueue queueProcess = null;
030:
031:            /**
032:             * @param id
033:             */
034:            public XSSLActionQueue(String id) {
035:                super (id);
036:                // XXX Auto-generated constructor stub
037:            }
038:
039:            /**
040:             * @param id
041:             * @param properties
042:             */
043:            public XSSLActionQueue(String id, HashMap properties) {
044:                super (id, properties);
045:                // XXX Auto-generated constructor stub
046:            }
047:
048:            /* (non-Javadoc)
049:             * @see org.xdev.base.xssl.XSSLReturn#getValue()
050:             */
051:            public Object getObjectValue() {
052:                // XXX Auto-generated method stub
053:                return null;
054:            }
055:
056:            /* (non-Javadoc)
057:             * @see org.xdev.base.xssl.XSSLAction#set()
058:             */
059:            protected void set() throws Exception {
060:                this .queueProcess = (XSSLActionQueue) this .getReference();
061:
062:                this .logDebug("Queue reference " + queueProcess
063:                        + " has been initialized: " + (queueProcess != null));
064:
065:                if (this .queueProcess != null) {
066:                    if (!this .queueProcess.isRunning()) {
067:                        this .queueProcess.start();
068:                    }
069:                } else {
070:                    this .start();
071:                    this .queueProcess = this ;
072:
073:                    this .define();
074:                }
075:            }
076:
077:            protected void invoke(XSSLAction item) throws Exception {
078:                this .queueProcess.queue(item);
079:            }
080:
081:            public void start() {
082:
083:                this .logDebug("Queue is starting up.");
084:
085:                if (this .queue == null) {
086:                    this .queue = new ArrayList();
087:                    this .setReference(this );
088:                }
089:
090:                if (this .queueThread == null) {
091:                    this .queueThread = new Thread(this );
092:                }
093:
094:                this .queueThread.start();
095:                this .running = true;
096:
097:                this .logDebug("Queue is up and running.");
098:            }
099:
100:            public void stop() {
101:                if (this .queueThread != null) {
102:                    this .queueThread.interrupt();
103:                }
104:                this .running = false;
105:            }
106:
107:            public boolean isRunning() {
108:                return this .running && this .queueThread != null
109:                        && this .queueThread.isAlive();
110:            }
111:
112:            public void queue(XSSLAction item) {
113:
114:                synchronized (queue) {
115:
116:                    this .logDebug("Queuing item: " + item);
117:
118:                    this .queue.add(item);
119:                    this .queue.notifyAll();
120:
121:                    this .logDebug("Queue has been notified...");
122:                }
123:            }
124:
125:            /* (non-Javadoc)
126:             * @see java.lang.Runnable#run()
127:             */
128:            public void run() {
129:
130:                XSSLAction queueItem = null;
131:
132:                if (this .queue != null) {
133:                    try {
134:                        while (!this .interrupted) {
135:                            synchronized (queue) {
136:                                while (queue.isEmpty()) {
137:
138:                                    this 
139:                                            .logDebug("Waiting for items being queued...");
140:
141:                                    this .queue.wait();
142:                                }
143:                                try {
144:
145:                                    queueItem = (XSSLAction) queue.remove(0);
146:
147:                                    this .logDebug("Processing queue item: "
148:                                            + queueItem);
149:
150:                                    this .processQueueItem(queueItem);
151:
152:                                    queueItem = null;
153:                                } catch (Exception ex) {
154:                                    this .logDebug(ex);
155:                                }
156:                            }
157:                        }
158:                    } catch (Exception ex) {
159:                        this .logDebug(ex);
160:                    }
161:                } else {
162:                    this .queueThread = null;
163:                }
164:
165:            }
166:
167:            protected abstract void processQueueItem(XSSLAction item)
168:                    throws Exception;
169:
170:            /**
171:             * @return Returns the queue.
172:             */
173:            public ArrayList getQueue() {
174:                return queue;
175:            }
176:
177:            /**
178:             * @param queue The queue to set.
179:             */
180:            public void setQueue(ArrayList queue) {
181:                this .queue = queue;
182:            }
183:
184:            /**
185:             * @return Returns the queueThread.
186:             */
187:            public Thread getQueueThread() {
188:                return queueThread;
189:            }
190:
191:            /**
192:             * @param queueThread The queueThread to set.
193:             */
194:            public void setQueueThread(Thread queueThread) {
195:                this .queueThread = queueThread;
196:            }
197:
198:            public void doFinalize() throws Exception {
199:                this .interrupted = true;
200:            }
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.