Co-existence
From APIDesign
Often one needs to provide similar, yet slightly different AlternativeBehaviors of the system. This page describes various levels on which such co-existence can take place.
TBD.
Contents |
Object level
One can configure two objects to have the same type (external interface), but slightly different behavior. The OSGi falls into this category. It is possible to have two running OSGi containers in the same virtual machine quite easily (as the API doesn't have any static getters).
Class level
The behavior is associated with class - e.g. in Java one needs to load the class by two different classloaders to get different behavior. This way one can get multiple singletons.
Call level
Is it? Would be behavior that inspects stacktraces. Probably Java's security policy falls into the category.
Process level
The behavior is the same throughout the process. System.getProperty("...") or various singletons in core Java libraries (SecurityManager) are example of such APIs. One needs to start new virtual machine to get different behavior.
Computer level
Running two different HTTP servers on port 80 is possible only with two computers (ignore case of virtual hosts).
Cloud level
To achieve parallel behavior of a complex system (kenai.com, netbeains.org) is often possible only with duplicating all its network.