Co-existence
From APIDesign
(Redirecting to AlternativeBehaviour) |
|||
(7 intermediate revisions not shown.) | |||
Line 1: | Line 1: | ||
- | + | Often one needs to provide similar, yet slightly different [[AlternativeBehavior]]s of the system. This page describes various levels on which such [[co-existence]] can take place. | |
+ | |||
+ | [[TBD]]. | ||
+ | |||
+ | == Object level == | ||
+ | |||
+ | One can configure two objects to have the same type (external interface), but slightly [[AlternativeBehavior|different behavior]]. The [[OSGi]] falls into this category. It is possible to have two running [[OSGi]] containers in the same [[HotSpot|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 [[ClassLoader]]s to get different behavior. This way one can get multiple [[singleton]]s. | ||
+ | |||
+ | The [[NetBeans Runtime Container]] falls into this category ([[NetBeans]] [[API]]s expose a lot of static getters). This was an intentional decision. We never wanted to have more than one [[GUI]] application in the process. | ||
+ | |||
+ | == 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 [[singleton]]s in core [[Java]] libraries ('''SecurityManager''') are example of such [[API]]s. One needs to start new [[HotSpot|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 [[AlternativeBehavior|parallel behavior]] of a complex system (kenai.com, netbeans.org) is often possible only with duplicating all its network. |
Current revision
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.
The NetBeans Runtime Container falls into this category (NetBeans APIs expose a lot of static getters). This was an intentional decision. We never wanted to have more than one GUI application in the process.
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, netbeans.org) is often possible only with duplicating all its network.