geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r369276 - in /geronimo/trunk/modules/session: ./ src/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/geronimo/ src/java/org/apache/geronimo/session/ src/test/ src/test/org/ src/test/org/apache/ src/test/org/apache/geronimo...
Date Sun, 15 Jan 2006 23:16:55 GMT
Author: dain
Date: Sun Jan 15 15:16:51 2006
New Revision: 369276

URL: http://svn.apache.org/viewcvs?rev=369276&view=rev
Log:
Add session module

Added:
    geronimo/trunk/modules/session/   (with props)
    geronimo/trunk/modules/session/LICENSE.txt   (with props)
    geronimo/trunk/modules/session/NOTICE.txt   (with props)
    geronimo/trunk/modules/session/project.xml   (with props)
    geronimo/trunk/modules/session/src/
    geronimo/trunk/modules/session/src/java/
    geronimo/trunk/modules/session/src/java/org/
    geronimo/trunk/modules/session/src/java/org/apache/
    geronimo/trunk/modules/session/src/java/org/apache/geronimo/
    geronimo/trunk/modules/session/src/java/org/apache/geronimo/session/
    geronimo/trunk/modules/session/src/java/org/apache/geronimo/session/package.html   (with
props)
    geronimo/trunk/modules/session/src/test/
    geronimo/trunk/modules/session/src/test/org/
    geronimo/trunk/modules/session/src/test/org/apache/
    geronimo/trunk/modules/session/src/test/org/apache/geronimo/
    geronimo/trunk/modules/session/src/test/org/apache/geronimo/session/

Propchange: geronimo/trunk/modules/session/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Jan 15 15:16:51 2006
@@ -0,0 +1,6 @@
+*.iml
+.project
+.classpath
+maven.log
+junit*.properties
+target

Added: geronimo/trunk/modules/session/LICENSE.txt
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/session/LICENSE.txt?rev=369276&view=auto
==============================================================================
--- geronimo/trunk/modules/session/LICENSE.txt (added)
+++ geronimo/trunk/modules/session/LICENSE.txt Sun Jan 15 15:16:51 2006
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Propchange: geronimo/trunk/modules/session/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/modules/session/NOTICE.txt
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/session/NOTICE.txt?rev=369276&view=auto
==============================================================================
--- geronimo/trunk/modules/session/NOTICE.txt (added)
+++ geronimo/trunk/modules/session/NOTICE.txt Sun Jan 15 15:16:51 2006
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Propchange: geronimo/trunk/modules/session/NOTICE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/modules/session/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/session/project.xml?rev=369276&view=auto
==============================================================================
--- geronimo/trunk/modules/session/project.xml (added)
+++ geronimo/trunk/modules/session/project.xml Sun Jan 15 15:16:51 2006
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright 2005 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+  
+<!-- $Rev$ $Date$ -->
+
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+    <name>Geronimo :: Session</name>
+    <id>geronimo-session</id>
+    <shortDescription>Geronimo Session</shortDescription>
+    <description>Geronimo Session</description>
+
+    <package>org.apache.geronimo.session</package>
+
+    <dependencies>
+    </dependencies>
+</project>

Propchange: geronimo/trunk/modules/session/project.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/modules/session/src/java/org/apache/geronimo/session/package.html
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/session/src/java/org/apache/geronimo/session/package.html?rev=369276&view=auto
==============================================================================
--- geronimo/trunk/modules/session/src/java/org/apache/geronimo/session/package.html (added)
+++ geronimo/trunk/modules/session/src/java/org/apache/geronimo/session/package.html Sun Jan
15 15:16:51 2006
@@ -0,0 +1,213 @@
+<html>
+<head>
+<title>Geronimo :: Session</title>
+</head>
+<body>
+
+<h1>Geronimo :: Session</h1>
+
+<p>
+This library provides a simple API for working with stateful session state so that it is
easy to 
+integrate different state management technologies into projects like OpenEJB, ServiceMix
or Tuscany while also
+providing the option of different providers; from simple solutions to highly dynamic clusters
with replication groups etc.
+</p>
+
+</p>
+Session management is a complex area with many different possible deployment options and
requirements.
+The idea behind this module is to create an extremely simple API that provides only the minimum
functionality
+a server to needs manage session state, while allowing for the most common session management
implementations. 
+</p>
+
+<h2>Deployment Scenarios</h2>
+
+<h5>Local Only</h5>
+
+You have a single server running a single Java VM.  The sessions are kept in memory and possibly
paged to disk.  Unused sessions are discarded as needed.
+
+<h5>Local Only - Reboot Safe</h5>
+
+Same as "Local Only" except you can reboot the server and recover all existing sessions.
 To accomplish this, the sessions must be written to a persistent store after modification.
+
+<h5>Distributed</h5>
+
+You have several Java VMs running on one or more servers.  A session only exists on a single
server and can not be moved.  If a request is received on a VM where the session is not present,
the request must be relocated to the VM which contains the session.  This can be accomplished
by either sending a redirect to the client or by the server forwarding the request to the
correct server directly.
+
+<h5>Distributed - Movable</h5>
+
+Same as "Distributed" except a session can be moved to another server.  A session can only
exists on a single server at one time.  If a request is received on a VM where the session
is not present, the server can optionally decide to move the remote session to the local server.
+ 
+<h5>Replicated</h5>
+
+Same as "Distributed - Movable" except sessions are saved to a persistent store, so in the
case of a server failure the sessions can be recovered by the remaining servers.  The persistent
store can be other servers or a globally shared store such as a shared disk, database, or
a cluster store (Tangosol).
+
+<h2>Use Cases</h2>
+
+<h5>Session is local</h5>
+
+This should be the default scenario and all other scenarios should be considered exceptions.
 If that is not the case, the hardware installation should be changed to the most common scenario,
is that the session in local.
+
+<ul>
+<li>A request arrives</li>
+<li>Lookup session location</li>
+<li>Session is local, so use session</li>
+<li>Release session</li>
+</ul>
+
+<h5>Redirect request</h5>
+
+This scenario requires that the client-server protocol supports redirects.  This is normally
true with smart Java clients, such as EJB or Lingo, but is not true for all but the most expensive
web load balancers.
+
+<ul>
+<li>A request arrives</li>
+<li>Lookup session location</li>
+<li>Session is remote, so get remote server address</li>
+<li>Send a redirect to client</li>
+</ul>
+
+<h5>Proxy request</h5>
+
+This scenario requires that the client-server protocol can be proxied.  This is normally
true for http requests, but may not be true for heavier protocols that rely on transport level
credentials to authenticate the client.
+ 
+<ul>
+<li>A request arrives</li>
+<li>Lookup session location</li>
+<li>Session is remote, so get remote server address</li>
+<li>Send the request to the remote server and send the response to the client [Option:
include correct remote server address in response so the client will send next request to
the correct server]</li>
+</ul>
+
+<h5>Move session</h5>
+
+The scenario requires an intra-server communication protocol where the local server can negotiate
with remote server to take over a session.
+
+<ul>
+<li>A request arrives</li>
+<li>Lookup session location</li>
+<li>Session is remote, so move the session to the local server</li>
+<li>Use session</li>
+<li>Release session</li>
+</ul>
+
+<h5>Background session recovery</h5>
+
+This requires a background process that can detect server failures, and that sessions are
backed up to a globally available location.  This also requires a process for determining
the new location for a session.
+
+<ul>
+<li>Background process informs group that a server is dead</li>
+<li>New location is selected either by the Group protocol itself or via intra-server
communication</li>
+<li>Master acquires the session from a backup store (note: this could be the local
server)</li>
+</ul>
+
+<h5>Request triggered session recovery</h5>
+
+This uses case explicitly states that we are not mixing the recovery process with the normal
session processing use cases.  In the case where a request arrives for a session on a failed
server, we wait for the recovery process to choose a new location for the session, and the
proceed using on with one of the local or remote session use cases.
+
+<ul>
+<li>A request arrives</li>
+<li>Lookup session location</li>
+<li>Session is remote, and remote server is dead</li>
+<li>Inform group of dead server, which kicks of the "Recover session 1" use case, or
sleep until Group protocol notices the dead server or dead server is resurrected.</li>
+<li>Session is now recovered, so continue using "Session is local", "Redirect request",
"Proxy request", or "Move session".
+</ul>
+
+<h2>Design Guidelines</h2>
+
+<p>
+We have tried to follow these guidelines while creating the API
+</p>
+
+<ul>
+<li>KISS (Keep it real simple stupid)</li>
+<li>There is a large diversity in qualities of service so lets not preclude any particular
model.
+e.g. sometimes loosing session state in the rare case of catastrophic hardware or process
failure is
+completely acceptable, in which case there is no need for backup copy. 
+In other times the loss of state is so vital and the changes to the state have to be transactional

+that using a database is the best solution.
+</li>
+<li>Support diversity of implementations; there are many ways of implementing session
management based on your requirements</li>
+<li>Lets follow the 80/20 rule and get the absolute basics working and rock solid first
before 
+we try clever & wacky stuff :). Sometimes its better to be simple and slow yet work 100%
of the time than 
+be fast and have bugs.
+</li>
+<li>Hide as much of the implementation details and algorithms used to distributed the
state
+from the API as is possible; instead focus on just what the server needs to make its decisions
on what to do
+with session state or a request.</li>
+<li>Use a POJO programming model to hide the underlying remoting technologies so that
it is easy to implement the API on top of
+various things like pure sockets/udp, JMS/ActiveCluster, WADI, JDBC, Tangosol etc. This should
also make it easy to test the edge cases easily
+as its sometimes hard to test every edge case without mocking out the underlying messaging
technology.</li>
+</ul>
+
+<h2>Assumptions</h2>
+ 
+<ul>
+<li>A session can only exist on one server at a time.</li>
+<li>Multiple concurrent requests to a session is allowed and can overlap.  The service
container will either handle serializing the request (EJB) or concurrent access to the session
data is allowed (Servlet).</li>
+</ul>
+
+<h2>Using the API</h2>
+
+<p>
+In terms of concurrency the idea is (whether there are backup copies of the state or not)

+there is a single Session object on all servers for a given SessionId. Any access to the
session uses
+either a read or write lock to ensure consistency of the sessions state. With one exception
+(migration) these locks are always using in-JVM locking since the session only exists in
one single JVM (though there
+may be backup copies).
+</p>
+
+<p>
+A request handler, such as the OpenEJB protocol, uses a Locator to find the SessionLocation
which is location of a given 
+Session in the system. A SessionLocation can be local or remote. The service then has multiple
choices of what to do to handle current
+request based on the location of the session. 
+</p>
+
+<p>
+If the session is local, the service can just use it immediately; when the SessionLocator.getSession()
method is called the session is locked
+using a read lock. The service can then access whatever different state it requires (it might
need to access the state of multiple
+stateful session beans). When the service has completed its request it calls the Session.release()
method so that the system
+can (when there are no other concurrent accesses of the session) backup the state or allow
session migration.
+</p>
+
+<p>
+When the session is remote the service has these choices; they are sorted in efficiency order
+</p>
+
+<ul>
+<li>REDIRECT: send a response to the requester of the service that the service should
go to the real server hosting the service.</li>
+<li>PROXY: the service proxies the request to the remote service which owns the session.</li>
+<li>MOVE: the service talks to the owner of the service and requests that they move
the session locally so that the current service becomes the master.</li>
+</ul>
+
+<p>
+Move is the heaviest of the choices since it involves communicating with the remote server,
performing a kind of distributed
+lock, moving the state, possibly relocating the back copies, then broadcasting the location
change to all servers.
+</p>
+
+<p>
+Redirect and Proxy are quite similar from the service perspective on one request; they are
both pretty fast and efficient.
+The main benefit of Redirect is that there should be no more requests for that particular
session again once the client
+has redirected to the actual location of the session - assuming there is a smart client capable
of redirecting; whereas each request will pay the proxy cost.
+Proxy is only really useful if you have a bad client/load balancer which tends to scatter
requests for the same session
+to multiple servers from time to time; so you may want to proxy for a while until you know
the new location the 
+client/load balancer has chosen for the session.
+</p>
+
+<p>
+So a typical policy may well be to try proxy the first few requests; once you hit some limit
you probably want to try 
+redirection if you can. Then if you hit some upper limit in the number of proxy requests
for the given 
+Session you may wish to just go ahead and move the session.
+</p>
+
+<p>
+With a well behaved smart client that handles redirection, then there is no need to use any
technique other then redirection.
+Though to help rebalance workload you may wish to move sessions around from time to time;
but then again in
+scenarios like EJB; sessions do not often last very long, so there is a natural decay in
the number of sessions in any
+server - so focussing purely on where to allocate new sessions, rather than moving existing
sessions is probably of more
+use and efficiency.
+</p>
+
+<p>
+Irrespective of the actual strategy an administrator chooses, the important thing is to give
the request handler all the information it needs 
+to make the best decision for the scenario.
+</p>
+
+</body>
+</html>

Propchange: geronimo/trunk/modules/session/src/java/org/apache/geronimo/session/package.html
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message