Source Code Cross Referenced for HACurrentDelegateImpl.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » ha » interceptor » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.ha.interceptor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * High Availability Service (HA) for JOnAS
003:         *
004:         * Copyright (C) 2006 Distributed Systems Lab.
005:         * Universidad Polit??cnica de Madrid (Spain)
006:         * Contact: http://lsd.ls.fi.upm.es/lsd
007:         *
008:         * This library is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU Lesser General Public
010:         * License as published by the Free Software Foundation; either
011:         * version 2.1 of the License, or any later version.
012:         *
013:         * This library is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016:         * Lesser General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU Lesser General Public
019:         * License along with this library; if not, write to the Free Software
020:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
021:         * USA
022:         *
023:         * --------------------------------------------------------------------------
024:         * $Id: HACurrentDelegateImpl.java 9280 2006-08-01 10:15:24Z japaz $
025:         * --------------------------------------------------------------------------
026:         */package org.objectweb.jonas.ha.interceptor;
027:
028:        import java.util.Stack;
029:
030:        import org.objectweb.carol.cmi.ha.RequestId;
031:        import org.objectweb.carol.cmi.ha.ViewIdWrapper;
032:        import org.objectweb.carol.cmi.ha.interceptor.HACurrentDelegate;
033:
034:        /**
035:         * This class handles the HAContext/Thread association
036:         * @author Francisco Perez-Sorrosal (fpsorrosal@no-spam@fi.upm.es)
037:         * @author Alberto Paz-Jimenez (apaz@no-spam@fi.upm.es)
038:         */
039:        public class HACurrentDelegateImpl implements  HACurrentDelegate {
040:
041:            /**
042:             * Local thread
043:             */
044:            private static InheritableThreadLocal threadCtx;
045:
046:            /**
047:             * Init the thread
048:             */
049:            static {
050:                threadCtx = new InheritableThreadLocal();
051:            }
052:
053:            /**
054:             * Unique instance
055:             */
056:            private static HACurrentDelegateImpl currentDelegate = new HACurrentDelegateImpl();
057:
058:            /**
059:             * Returns the unique instance
060:             * @return the current instance
061:             */
062:            public static HACurrentDelegateImpl getCurrent() {
063:                return currentDelegate;
064:            }
065:
066:            /**
067:             * Set the requests stack in the current context
068:             * @param requests the next request
069:             */
070:            public void setRequests(Stack requests) {
071:                HACurrentContext current = getCurrentContext();
072:                current.setRequests(requests);
073:                threadCtx.set(current);
074:            }
075:
076:            /**
077:             * Get the request stack
078:             * @return the request stack
079:             */
080:            public Stack getRequests() {
081:                return getCurrentContext().getRequests();
082:            }
083:
084:            /**
085:             * Put the request in the request stack 
086:             * @param nextReq the next request
087:             */
088:            public void putNextReq(RequestId nextReq) {
089:                HACurrentContext current = getCurrentContext();
090:                current.putNextReq(nextReq);
091:                threadCtx.set(current);
092:            }
093:
094:            /**
095:             * Sets the onFailover variable
096:             * @param onFailover
097:             */
098:            public void setOnFailover(boolean onFailover) {
099:                HACurrentContext current = getCurrentContext();
100:                current.setOnFailover(onFailover);
101:                threadCtx.set(current);
102:            }
103:
104:            /**
105:             * Gets the onFailover variable
106:             * @return true if on failover
107:             */
108:            public boolean isOnFailover() {
109:                return getCurrentContext().isOnFailover();
110:
111:            }
112:
113:            private HACurrentContext getCurrentContext() {
114:                HACurrentContext current = (HACurrentContext) threadCtx.get();
115:                if (current == null) {
116:                    current = new HACurrentContext();
117:                }
118:                return current;
119:            }
120:
121:            public void pushViewIdWrapper(ViewIdWrapper info) {
122:                HACurrentContext current = (HACurrentContext) threadCtx.get();
123:                if (current == null) {
124:                    current = new HACurrentContext();
125:                }
126:                current.setViewIdWrapper(info);
127:                threadCtx.set(current);
128:            }
129:
130:            public ViewIdWrapper getViewIdWrapper() {
131:                HACurrentContext current = (HACurrentContext) threadCtx.get();
132:                if (current == null) {
133:                    current = new HACurrentContext();
134:                }
135:                return current.getViewIdWrapper();
136:            }
137:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.