Globus Toolkit 4: Programming Java Services

Up to this point in the book, all our resources have been in-memory resources.In other words, the objects representing our resources were stored in main memory (RAM). In some cases, however, it is preferable for our resources to be persistent, or stored in secondary storage (disk, database, etc.). In this chapter we will explain how to add persistence to our resources. We will start by providing comparison of in-memory and persistent resources. Next, we provide an overview of the PersistentResource interface which must be implemented by persistent resources. Then, we show how we can add persistence to our MathService example. Finally, we conclude by briefly discussing how we can use resource caches to improve our application's performance.
Having our resources stored in memory can work fine in many cases, but there are also many cases where in-memory resources are not a good option. This type of resource has two main disadvantages:
They don't survive container restarts: When a container is stopped, all its inmemory information is lost. In some cases, this might be perfectly OK for us but, in many cases, we will want our resources to survive container restarts.
They consume main memory: Main memory (RAM) is limited and, if we need to manage large amounts of resources, our system's performance could be impacted.
Persistent resources, on the other hand, reside in secondary storage, such as files on a disk or a database. Whenever the container needs to use...