Example: Web Utilities Java Package - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Example: Web Utilities Java Package

Description:

Provide web utilities to web clients (browsers, web-enabled desktops or file managers, ... Make Cache memory immortal, handle Cache memory manually within Cache object ... – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 7
Provided by: csWu4
Category:

less

Transcript and Presenter's Notes

Title: Example: Web Utilities Java Package


1
ExampleWeb Utilities Java Package
  • Goals of the package
  • Provide web utilities to web clients (browsers,
    web-enabled desktops or file managers, ...)
  • Encapsulate web concepts (cookies, request
    headers, MIME-types, resources, cache)
  • Concerns
  • Should everything exist in caller's memory space?
  • Should cache be system- or user-wide?
  • Could Web Utilities memory be better handled by
    exploiting what we know about its allocation and
    deallocation behavior?

2
Web Utilities
Connection
Mimetype
Request
Response
Web Utilities
URL
Cache
Site
Resource
Cookie
3
What we Want Cache
  • Define the behavior we want in order to
    cache-enable the system
  • When a new Resource object is created (and
    associated with a Site object and resource path),
    check the cache for a match first
  • When a Resource is asked to load() (creating a
    new Request/Response pair), check to see if the
    Response is cached
  • When the cache gets too large, purge some of the
    older entries

4
What we Want Memory
  • Define the behavior we want in order to use the
    right type of memory
  • Cacheable items should be placed in Cache memory
    instead of thread-associated ScopedMemory or
    HeapMemory
  • Cache should have a limited maximum size
  • This could be enforced with a MemoryArea instance
    of a particular size
  • We may not want to use a mark sweep garbage
    collector for Cache memory
  • Use our own design of garbage collector, or
  • Make Cache memory immortal, handle Cache memory
    manually within Cache object

5
Observations
  • These memory and caching concerns crosscut the
    functionality of the package
  • Can't easily modularize these concerns they are
    strongly coupled with each other and the rest of
    the package
  • Code copy paste
  • No clean way in RTJava to put our objects in
    different memory areas than the caller
  • May want to handle caching or Cache memory
    differently in different contexts
  • Resource prefetching

6
Aspect-Oriented Programming
  • Intercept calls to create new Resources and other
    Cacheable objects
  • Put them in Cache memory
  • Cache object notification
  • Respond to the context in which we were called
  • Browser vs. automatic webcrawler
  • Modularity within the package code itself
  • Separated cache and memory concerns
Write a Comment
User Comments (0)
About PowerShow.com