Source Code Cross Referenced for JSessionSwitch.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas_ejb » container » 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_ejb.container 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999-2004 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: JSessionSwitch.java 7933 2006-01-25 15:15:08Z durieuxp $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas_ejb.container;
025:
026:        import java.rmi.RemoteException;
027:
028:        import javax.transaction.Transaction;
029:
030:        import org.objectweb.jonas_timer.TimerEvent;
031:        import org.objectweb.jonas_timer.TimerEventListener;
032:        import org.objectweb.jonas_timer.TimerManager;
033:
034:        import org.objectweb.util.monolog.api.BasicLevel;
035:
036:        /**
037:         * JSessionSwitch holds all the code that is common to EJBObject and
038:         * EJBLocalObject for session beans. It mainly keep a reference on the
039:         * SessionContext and is used to manage the timeout for the session. This class
040:         * has 2 subclasses, depending if session is stateless or stateful.
041:         * @author Philippe Durieux
042:         */
043:        public abstract class JSessionSwitch implements  TimerEventListener {
044:
045:            protected JSessionFactory bf;
046:
047:            protected JSessionLocal mylocal = null;
048:
049:            protected JSessionRemote myremote = null;
050:
051:            protected TimerEvent mytimer = null;
052:
053:            /**
054:             * constructor. a new object is build when the pool managed by
055:             * JSessionFactory becomes empty.
056:             * @param bf The Bean Factory
057:             */
058:            public JSessionSwitch(JSessionFactory bf) throws RemoteException {
059:                if (TraceEjb.isDebugIc()) {
060:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
061:                }
062:                this .bf = bf;
063:
064:                // Create EJBObject if bean has a Remote Interface
065:                if (bf.getHome() != null) {
066:                    myremote = ((JSessionHome) bf.getHome())
067:                            .createRemoteObject();
068:                    myremote.setSessionSwitch(this );
069:                }
070:
071:                // Create EJBLocalObject if bean has a Local Interface
072:                if (bf.getLocalHome() != null) {
073:                    mylocal = ((JSessionLocalHome) bf.getLocalHome())
074:                            .createLocalObject();
075:                    mylocal.setSessionSwitch(this );
076:                }
077:            }
078:
079:            /**
080:             * @return the underlaying EJBLocalObject
081:             */
082:            public JSessionLocal getLocal() {
083:                return mylocal;
084:            }
085:
086:            /**
087:             * @return the underlaying EJBObject
088:             */
089:            public JSessionRemote getRemote() {
090:                return myremote;
091:            }
092:
093:            /**
094:             * @return the BeanFactory
095:             */
096:            public JSessionFactory getBeanFactory() {
097:                return bf;
098:            }
099:
100:            /**
101:             * Start a timer for this Session.
102:             * @param timeout nb of milliseconds max this Session should live.
103:             */
104:            public void startTimer(int timeout) {
105:                if (TraceEjb.isDebugIc()) {
106:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
107:                }
108:                mytimer = TimerManager.getInstance().addTimerMs(this , timeout,
109:                        null, false);
110:            }
111:
112:            /**
113:             * Stop the Timer associated to the Session
114:             */
115:            public void stopTimer() {
116:                if (TraceEjb.isDebugIc()) {
117:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
118:                }
119:                if (mytimer != null) {
120:                    mytimer.unset();
121:                    mytimer = null;
122:                }
123:            }
124:
125:            public abstract JSessionContext getICtx(Transaction tx)
126:                    throws RemoteException;
127:
128:            public abstract void releaseICtx(RequestCtx req, boolean discard);
129:
130:            public abstract void setMustCommit(boolean mc);
131:
132:            public abstract void saveBeanTx();
133:
134:            public abstract void pushConnectionList();
135:
136:            public abstract void popConnectionList();
137:
138:            public abstract void enlistConnections(Transaction tx);
139:
140:            public abstract void delistConnections(Transaction tx);
141:
142:            public abstract void noLongerUsed();
143:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.