|
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Java Basics HTTP Session Garbage Collector
Removing cached data
By: Abhinasha Karana
Feb. 5, 2004 12:00 AM
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 use–case 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 Reader Feedback: Page 1 of 1
Your Feedback
Latest Cloud Developer Stories
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 Cloud Computing News
|
||||||||||||||||||||||||||||||||||||||||||||||||||||