Java Doc for SerialPersist.java in  » Web-Server » Brazil » sunlabs » brazil » session » 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 » Web Server » Brazil » sunlabs.brazil.session 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   sunlabs.brazil.session.SessionManager
      sunlabs.brazil.session.SerialPersist

SerialPersist
public class SerialPersist extends SessionManager implements Handler,SignalHandler(Code)
The SerialPersist class is a SessionManager that uses Java object serialization to make a persistent store of the session information for a server. See SessionManager for a description of sessions.

This class uses the signal-handling capabilities of the Solaris-specific sun.misc package. When the program is interrupted by a Ctrl-C (SIGINT), the current session information is serialized to a "store" file. When the program is restarted, the session information is restored from the store file.

To use this SessionManager effectively, the developer should try to ensure that only Serializable objects are stored in the session manager. With default object serialization, the developer will get a runtime IOException if an object in the hierarchy is not actually serializable, for example, if a (Serializable) Hashtable contains an arbitrary non-serializable object.

This class will traverse the session hierarchy and attempt to remove all non-serializable objects before writing to the store file. This means that after restoring, the session information may not correspond exactly to what it was present before. Consumers of session information should be prepared to deal with some session information disappearing. For instance, the TemplateRunner keeps the templates for each session in the SessionManager and will reconstruct the templates if some or all of them disappear during a restore.

This class will recursively traverse the elements of (specifically) any Hashtable, Vector, or array it finds in the session hierarchy to ensure that the elements themselves are Serializable. If the element is not, it is removed from its container. If the container becomes zero-length because all its elements were removed, the container is then itself removed. For arrays, the offending non-serializable element is instead replaced with null, since arrays cannot be resized.


This SessionManager implements the Handler interface,and examines the following request properties at init time:
store
The name of the store file to hold the session information. The default value is "store".
saveUrl
The name of a url that will cause the session information to be saved without terminating the server. WARNING! this has the side effect of removing non serializable elements from the session table, which can lead to disturbing behavior.

author:
   Stephen Uhler (stephen.uhler@sun.com)
author:
   Colin Stevens (colin.stevens@sun.com)
version:
   1.11, 00/12/11


Field Summary
 Stringprefix
    
 Stringsave
    
 Serverserver
    
 Stringstore
    


Method Summary
static  Objectclean(Object root, Object obj)
    
public static  ObjectcleanForSerialization(Object obj)
     Recursively decend through an object "Cleaning" it for serialization.
public  voidhandle(Signal sig)
    
public  booleaninit(Server server, String prefix)
    
 voidreadStore()
     Call this first, to read in the store, if available.
public  booleanrespond(Request request)
    
 voidsaveStore()
     Call this to "save" the store, typically before exiting.

Field Detail
prefix
String prefix(Code)



save
String save(Code)



server
Server server(Code)



store
String store(Code)





Method Detail
clean
static Object clean(Object root, Object obj)(Code)



cleanForSerialization
public static Object cleanForSerialization(Object obj)(Code)
Recursively decend through an object "Cleaning" it for serialization. For the container objects "Hashtable", "Vector", and "Array", look at every object contained within it, removing all those that are not serializable by either removing them, or setting them to null. This allows successful serialization even if some elements of the base object, or its desendents can't be serialized. This is intended for saving and restoring typical session information. Care must be taken by the caller that data integrety is maintained when non-serializable objects are zapped.
Parameters:
  obj - The object to Clean



handle
public void handle(Signal sig)(Code)



init
public boolean init(Server server, String prefix)(Code)



readStore
void readStore()(Code)
Call this first, to read in the store, if available. One store per application



respond
public boolean respond(Request request)(Code)



saveStore
void saveStore()(Code)
Call this to "save" the store, typically before exiting. This should be done on a signal handler Before calling writeObject, we need to iterate through the sessions table, and remove all values that are not serializable



Fields inherited from sunlabs.brazil.session.SessionManager
protected Hashtable sessions(Code)(Java Doc)

Methods inherited from sunlabs.brazil.session.SessionManager
public static Object getSession(Object session, Object ident, Class type)(Code)(Java Doc)
public Object getSessionObject(Object session, Object ident, Class type)(Code)(Java Doc)
public static void setSessionManager(SessionManager mgr)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.