Source Code Cross Referenced for HAClientInterceptor.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: HAClientInterceptor.java 9280 2006-08-01 10:15:24Z japaz $
025:         * --------------------------------------------------------------------------
026:         */package org.objectweb.jonas.ha.interceptor;
027:
028:        import java.io.IOException;
029:        import java.util.Stack;
030:
031:        import org.objectweb.carol.cmi.configuration.TraceCmi;
032:        import org.objectweb.carol.cmi.ha.Constants;
033:        import org.objectweb.carol.rmi.jrmp.interceptor.JClientRequestInfo;
034:        import org.objectweb.carol.rmi.jrmp.interceptor.JClientRequestInterceptor;
035:
036:        /**
037:         * This class represents the client side of the interceptor mechanism
038:         * implemented to transfer replication related information between client
039:         * and server sides.
040:         */
041:        public class HAClientInterceptor implements  JClientRequestInterceptor {
042:
043:            /**
044:             * 
045:             */
046:            private static final long serialVersionUID = 1L;
047:
048:            /**
049:             * Interceptor name
050:             */
051:            private String interceptorName = "HAClientInterceptor";
052:
053:            /**
054:             * Constructor
055:             */
056:            public HAClientInterceptor() {
057:            }
058:
059:            /**
060:             * Get the name of this interceptor
061:             * @return name
062:             */
063:            public String name() {
064:                return interceptorName;
065:            }
066:
067:            /**
068:             * Constructs the HAContext with the required replication information on
069:             * the client side
070:             */
071:            public void send_request(JClientRequestInfo jri) throws IOException {
072:
073:                if (TraceCmi.isDebugCmiHA()) {
074:                    TraceCmi.debugCmiHA("----------------------------------");
075:                    TraceCmi.debugCmiHA("HAClientInterceptor: send_request");
076:                }
077:                // Get the current HA Context info associated to the thread
078:                HACurrentDelegateImpl current = HACurrentDelegateImpl
079:                        .getCurrent();
080:                // Create the new HAContext to propagate between interceptors
081:                HAContext newHACtx = new HAContext();
082:                // Fill the "req_id" field to propagate through the interceptor if the
083:                // nextReq has been included in the HA current context (held in the
084:                // thread-local variable) by the stub
085:
086:                Stack requests = current.getRequests();
087:                newHACtx.setRequests(requests);
088:                newHACtx.setViewIdWrapper(current.getViewIdWrapper());
089:                newHACtx.setOnFailover(current.isOnFailover());
090:                if (TraceCmi.isDebugCmiHA()) {
091:                    TraceCmi.debugCmiHA("Propagating requests chain: "
092:                            + newHACtx);
093:                }
094:
095:                // Finally, include the new HAContext created to be propagated through
096:                // the interceptor
097:                jri.add_request_service_context(newHACtx);
098:                if (TraceCmi.isDebugCmiHA()) {
099:                    TraceCmi.debugCmiHA("----------------------------------");
100:                }
101:            }
102:
103:            public void receive_reply(JClientRequestInfo jri)
104:                    throws IOException {
105:                if (TraceCmi.isDebugCmiHA()) {
106:                    TraceCmi.debugCmiHA("----------------------------------");
107:                    TraceCmi.debugCmiHA("HAClientInterceptor: receive_reply");
108:                }
109:                getHAContext(jri);
110:                if (TraceCmi.isDebugCmiHA()) {
111:                    TraceCmi.debugCmiHA("----------------------------------");
112:                }
113:            }
114:
115:            public void receive_exception(JClientRequestInfo jri)
116:                    throws IOException {
117:                if (TraceCmi.isDebugCmiHA()) {
118:                    TraceCmi.debugCmiHA("----------------------------------");
119:                    TraceCmi
120:                            .debugCmiHA("HAClientInterceptor: receive_exception");
121:                }
122:                getHAContext(jri);
123:                if (TraceCmi.isDebugCmiHA()) {
124:                    TraceCmi.debugCmiHA("----------------------------------");
125:                }
126:            }
127:
128:            public void receive_other(JClientRequestInfo jri)
129:                    throws IOException {
130:                if (TraceCmi.isDebugCmiHA()) {
131:                    TraceCmi.debugCmiHA("----------------------------------");
132:                    TraceCmi.debugCmiHA("HAClientInterceptor: receive_other");
133:                }
134:                getHAContext(jri);
135:                if (TraceCmi.isDebugCmiHA()) {
136:                    TraceCmi.debugCmiHA("----------------------------------");
137:                }
138:            }
139:
140:            //-------------------------------------------------------------------------
141:            // Other public unused methods
142:            //-------------------------------------------------------------------------
143:
144:            public void destroy() {
145:            }
146:
147:            public void send_poll(JClientRequestInfo jri) throws IOException {
148:            }
149:
150:            private void getHAContext(JClientRequestInfo jri) {
151:                // Get the HAContext from the received info
152:                HAContext receivedCtx = (HAContext) jri
153:                        .get_request_service_context(Constants.HA_CTX_ID);
154:                if (TraceCmi.isDebugCmiHA()) {
155:                    TraceCmi.debugCmiHA("receivedCtx: " + receivedCtx);
156:                }
157:                // Get the current Thread/HAContext association class
158:                HACurrentDelegateImpl current = HACurrentDelegateImpl
159:                        .getCurrent();
160:
161:                Stack requests = receivedCtx.getRequests();
162:                current.setRequests(requests);
163:                current.pushViewIdWrapper(receivedCtx.getViewIdWrapper());
164:            }
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.