javawebparts.session
Class SessionSize

java.lang.Object
  |
  +--javawebparts.session.SessionSize

public class SessionSize
extends java.lang.Object

This class provides a way to get the size of a session object.

Author:
Frank W. Zammetti.

Field Summary
private  java.util.ArrayList failureReasons
          Collection of reasons why session size could not be determined.
private  boolean ignoreNonSerializable
          This flag determines if the session size will continue to be calculated even when a non-serializable objects are found.
private  javax.servlet.http.HttpSession session
          Reference to session this object is associated with.
 
Constructor Summary
SessionSize(javax.servlet.http.HttpSession inSession)
          constructor.
 
Method Summary
 int getSessionSize()
          This method is used to get the total size of a current, valid HttpSession object it is passed.
 void setIgnoreNonSerializable(boolean inSetting)
          Mutator for the ignoreNonSerializable field.
 java.util.List whyFailed()
          When getSessionSize() returns -1, this method can be called to retrieve the collection of reasons it failed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

private javax.servlet.http.HttpSession session
Reference to session this object is associated with.


failureReasons

private java.util.ArrayList failureReasons
Collection of reasons why session size could not be determined.


ignoreNonSerializable

private boolean ignoreNonSerializable
This flag determines if the session size will continue to be calculated even when a non-serializable objects are found. This can be useful when you know your session won't pass this tests here but want a size, and understand it will always be an understated size, but don't care. This feature was suggested by Wendy Smoak.

Constructor Detail

SessionSize

public SessionSize(javax.servlet.http.HttpSession inSession)
constructor.

Parameters:
inSession - object this object will be associated with.
Method Detail

setIgnoreNonSerializable

public void setIgnoreNonSerializable(boolean inSetting)
Mutator for the ignoreNonSerializable field.

Parameters:
inSetting - True to calculate session size regardless of whether non-serializable objects are found in it, false otherwise (false is the default).

getSessionSize

public int getSessionSize()
This method is used to get the total size of a current, valid HttpSession object it is passed.

Returns:
The total size of session in bytes, or -1 if the size could not be determined.

whyFailed

public java.util.List whyFailed()
When getSessionSize() returns -1, this method can be called to retrieve the collection of reasons it failed.

Returns:
Collection of failures why the session size could not be determiend.


Copyright © 2005 Frank W. Zammetti