|
|
YOUR FEEDBACK
Did you read today's front page stories & breaking news?
SOA World Conference
Virtualization Conference $200 Savings Expire May 16, 2008... – Register Today!
SYS-CON.TV |
TOP THREE LINKS YOU MUST CLICK ON Java Basics
HTTP Session Garbage Collector
Removing cached data
By: Abhinasha Karana
Digg This!
A common approach to caching data in Web applications is to use an HTTP session. A business use case that spans multiple HTTP requests may create the need for caching in a Web tier. Once business usecase processing is completed, this cached data needs to be removed. Failure to do this may lead to memory leakage, which becomes noticeable when a user HTTP session continues for hours. The Solution
Rule 1: Only one use case is active at any instance: A user cannot process multiple use cases at a given instance. Rule 2: A use case processing stage governs the cache element life cycle:
Rule 3: Handlers operate inside a use case context: User navigation dynamically builds a cache hierarchy tree with the handler and use case context as nodes and the cache element as a leaf. The handler node could hold a successor handler, cache elements, and a nested use case context. The use case context node holds a start handler. The root of the tree is the use case context. Rule 4: Handlers operate on cache elements: Handlers create, read, and destroy cache elements. Keeping these rules in mind, let's address the stated problem. We have conceptually built a cache hierarchy tree, which is the key concept to addressing the problem. Step 1: Each request will go through the cache garbage collector Figure 1 addresses the memory leakage problem. The introduction of the cache hierarchy tree removes tight coupling between handlers.
![]() Step 2: Handlers navigate the cache hierarchy tree
Efficient memory handling at a granular level is achieved. At the same time, the decoupled handlers make future enhancements easier. Solution Implementation
![]() Cache Hierarchy Tree Management Conclusion
LATEST JAVA STORIES & POSTS
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK BREAKING JAVA NEWS
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||