Parameterized subsystems are made to be reusable, this means one should be able to instantiate the same subsystem several times for the same deployment. That is, one should not only set a subsystem instance, but also add many of them.
To consider: should the set method be replaced by an add method? the associated semantics regarding subsystems with parameters should be maintained: if a subsystem has parameters, an instance with no parameters should be used. If an instance with arguments is added, the first one should not be used.
Example:
for (i : 1..4) { // 4 instances of the Sub subsystem
// (elements within Sub should be deployed 4 times)
add(new com.company.Sub("node" + i, "another-param"))
}
start(true)
NOTICE: with this change, subsystem instances must be added explicitely in order to include a subsystem in the deployment. This means that instances with empty constructor are no longer added automatically.
Parameterized subsystems are made to be reusable, this means one should be able to instantiate the same subsystem several times for the same deployment. That is, one should not only
set
a subsystem instance, but also add many of them.To consider: should the
set
method be replaced by anadd
method? the associated semantics regarding subsystems with parameters should be maintained: if a subsystem has parameters, an instance with no parameters should be used. If an instance with arguments is added, the first one should not be used.Example: