|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.2) E14255-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.bea.p13n.http.SessionMonitor
public class SessionMonitor
Monitor changes to the Http Session. Useful for debugging session problems, especially as they affect cluster session replication. Can be used to find large and non-serializable session attributes, as well as what code is responsible for these attributes.
This class will report when an attribute is added, replaced, or removed in the session. It also attempts to look up the stack trace and report a line of code where the session change originated. For additions and removals, it also reports the size of the attribute. If an added attribute is non-serializable, this is reported as a warning.
On every change, the current total session size is also reported.
All reports are logged to the server log as Info level messages, except for non-serializable attributes which are Warnings. The subsystem name for the messages is this class name (com.bea.p13n.http.SessionMonitor). Note that the configuration for your server may not output Info messages to stdout, but only to the log file. So you should check the logging configuration for your server.
To use this class, add the following to your WebApp's web.xml:
<listener> <listener-class> com.bea.p13n.http.SessionMonitor </listener-class> </listener>
It is important to note that this class should be used only for debugging, because the serialization and stack trace lookups can be expensive operations.
Note: Sizes are in bytes, and based on the serialization of the attribute to a stream. This will thus include all referenced objects, and will detect non-serializable objects contained within serializable containers (such as a non-serializable object contained in a Map), which can not generally be detected by looking at "myAttribute instanceof Serializable". A size obtained this way is not the same as the memory (heap) occupied by this attribute, but does indicate the cost of replicating or persisting the attribute in a cluster.
Nested Class Summary | |
---|---|
static class |
SessionMonitor.AttributeInfoOnly Use this class instead of SessionMonitor if you only want attribute info (add/remove/replace, serialization test, and size) without logging the total session size each time. |
static class |
SessionMonitor.TotalSessionSizeOnly Use this class instead of SessionMonitor if you only want total session size (on each session change) without any attribute info. |
Constructor Summary | |
---|---|
SessionMonitor() Public default constructor required by HttpSessionAttributeListener |
Method Summary | |
---|---|
void |
attributeAdded(javax.servlet.http.HttpSessionBindingEvent bindingEvent) HttpSessionAttributeListener.attributeAdded() implementation. |
void |
attributeRemoved(javax.servlet.http.HttpSessionBindingEvent bindingEvent) HttpSessionAttributeListener.attributeRemoved() implementation. |
void |
attributeReplaced(javax.servlet.http.HttpSessionBindingEvent bindingEvent) HttpSessionAttributeListener.attributeReplaced() implementation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SessionMonitor()
Method Detail |
---|
public void attributeAdded(javax.servlet.http.HttpSessionBindingEvent bindingEvent)
attributeAdded
in interface javax.servlet.http.HttpSessionAttributeListener
public void attributeRemoved(javax.servlet.http.HttpSessionBindingEvent bindingEvent)
attributeRemoved
in interface javax.servlet.http.HttpSessionAttributeListener
public void attributeReplaced(javax.servlet.http.HttpSessionBindingEvent bindingEvent)
attributeReplaced
in interface javax.servlet.http.HttpSessionAttributeListener
|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.2) E14255-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2010, Oracle. All rights reserved.