X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=system%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcore%2FAbstractComponent.java;h=04f0480125c36ff5737258b728b64461b3d3b11d;hb=756145743d46d1cf4e4e32c03a32526aa059f1e1;hp=28bb6ff19b28b0f93988695525f672d9fec35bb5;hpb=fddbe9b130633c7d8925f2580afea65767d1d615;p=utils diff --git a/system/general/src/main/java/org/wamblee/system/core/AbstractComponent.java b/system/general/src/main/java/org/wamblee/system/core/AbstractComponent.java index 28bb6ff1..04f04801 100644 --- a/system/general/src/main/java/org/wamblee/system/core/AbstractComponent.java +++ b/system/general/src/main/java/org/wamblee/system/core/AbstractComponent.java @@ -112,12 +112,13 @@ public abstract class AbstractComponent implements Component { @Override public final Type start(Scope aScope) { - LOG.info("Initializing '" + getQualifiedName() + "'"); + LOG.info("Initialization starting '" + getQualifiedName() + "'"); List oldRemaining = _remaining.get(); _remaining.set(new ArrayList(Arrays.asList(getProvidedInterfaces()))); try { Type runtime = doStart(aScope); checkNotStartedInterfaces(); + LOG.info("Initialization finished '" + getQualifiedName() + "'"); return runtime; } finally { _remaining.set(oldRemaining); @@ -158,13 +159,18 @@ public abstract class AbstractComponent implements Component { Object aService, Scope aScope) { LOG.info("Interface '" + getQualifiedName() + "." + aDescriptor.getName() + "' started."); - _remaining.get().remove(aDescriptor); + if ( !_remaining.get().remove(aDescriptor) ) { + throw new SystemAssemblyException("Component '" + getQualifiedName() + "' started an unexpected interface '" + + aDescriptor + "' that was not registerd as a provided interface before"); + } aScope.publishInterface(aDescriptor, aService); } @Override public void stop(Type aRuntime) { + LOG.info("Stopping initiated '" + getQualifiedName() + "'"); doStop(aRuntime); + LOG.info("Stopping completed '" + getQualifiedName() + "'"); } protected abstract void doStop(Type aRuntime);