Browse Prior Art Database

A Reloading, Caching Resource Manager for Web Applications Disclosure Number: IPCOM000015736D
Original Publication Date: 2002-Jul-23
Included in the Prior Art Database: 2003-Jun-21

Publishing Venue



Web applications often load resources such as XML files, DTDs, schemas, etc. For example, a Web Service might have to read SQL query statements stored in a XML file. During development these resources are usually changed frequently but in order for the change to take affect, the Web application must often be restarted which may take a long time. This reduces developer productivity. Also, in production, it is often desirable to update a resource without restarting the Web application since that interrupts service. This invention improves developer productivity and application availability by managing resources so that they are automatically reloaded when modified. The reloading is controlled by a reload policy which can be adjusted for use both during development and in production. The resources are also cached to avoid redundant loading of shared resources. The invention consists of a Java class library that provides a resource management framework that can be extended to handle new resource types and loading mechanisms. The key classes are: ReloadPolicy enables or disables reloading and specifies a expiry time interval. A resource is considered to be fresh is the time since it was last checked does not exceed the expiry time interval. If a request for the resource is made within the expiry time interval, then the cached version is returned. Otherwise the resource is checked for changes and reloaded if necessary. For example, during development, the expiry time might be set to 5 seconds, whereas in production it might be set to 60 seconds in order to avoid unnecessary processing. ResourceCache caches a set of resources ResourceGroup a named collection of cached resources that share properties and a reload policy ResourceDescriptor identifies a resource and references a resource loader and content handler ResourceLoader obtains an input stream for a resource and determines if a resource has changed since last loaded. This is an interface that is subclasses for various resource loading mechanisms. For example, resource may be loaded through a Java class loader, from the file system, or from a database. ContentHandler converts the input stream into a Java object that is stored in the resource cache. This is an interface that is subclasses for various resource types. For example, the resource input stream may be converted into a standard XML DOM object or a user defined class. The following diagram illustrates the operation of the resource manager.