The parametric singleton design pattern combines the singleton design pattern with a parameter that enables unique creation of instances of a class. These instances are cached in a table. When a user asks for an instance with these parameters, the table is checked and instances are created conditionally. Parametric lazy instantiation causes instance creation, with the given parameters, if, and only if, it is not already in the table. Thus, the table yields the instance with optional creational effort. Lazy instantiation is not new, nor, for that matter, is the singleton design pattern. However, parametric lazy instantiation is new and so is the parametric singleton. We apply our parametric singleton design pattern to the retrieval of RMI registries bound to a given port. The goal of our system is to make sure that no two RMI registries on the same machine are listening to the same socket and to make use of the RMI registries after creation. RMI registries are used in distributed compu...
Douglas A. Lyon, Francisco Castellanos