[
https://issues.apache.org/jira/browse/CAMEL-13094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16748455#comment-16748455
]
Thomas Diesler edited comment on CAMEL-13094 at 1/22/19 7:40 AM:
-----------------------------------------------------------------
{code}
try {
doStart();
started.set(true);
starting.set(false);
stopping.set(false);
stopped.set(false);
suspending.set(false);
suspended.set(false);
shutdown.set(false);
shuttingdown.set(false);
} catch (Exception e) {
try {
stop();
} catch (Exception e2) {
// Ignore exceptions as we want to show the original
exception
} finally {
// ensure flags get reset to stopped as we failed during
starting
stopping.set(false);
stopped.set(true);
starting.set(false);
started.set(false);
suspending.set(false);
suspended.set(false);
shutdown.set(false);
shuttingdown.set(false);
}
throw e;
}
{code}
https://github.com/apache/camel/blob/camel-2.23.x/camel-core/src/main/java/org/apache/camel/support/ServiceSupport.java#L83
vs.
{code}
try {
status = STARTING;
log.trace("Starting service");
doStart();
status = STARTED;
log.trace("Service started");
} catch (Exception e) {
status = FAILED;
log.trace("Error while starting service", e);
throw e;
}
{code}
https://github.com/apache/camel/blob/master/camel-api/src/main/java/org/apache/camel/support/ServiceSupport.java#L90
was (Author: tdiesler):
{code}
try {
doStart();
started.set(true);
starting.set(false);
stopping.set(false);
stopped.set(false);
suspending.set(false);
suspended.set(false);
shutdown.set(false);
shuttingdown.set(false);
} catch (Exception e) {
try {
stop();
} catch (Exception e2) {
// Ignore exceptions as we want to show the original
exception
} finally {
// ensure flags get reset to stopped as we failed during
starting
stopping.set(false);
stopped.set(true);
starting.set(false);
started.set(false);
suspending.set(false);
suspended.set(false);
shutdown.set(false);
shuttingdown.set(false);
}
throw e;
}
{code}
https://github.com/apache/camel/blob/camel-2.23.x/camel-core/src/main/java/org/apache/camel/support/ServiceSupport.java#L83
vs.
https://github.com/apache/camel/blob/master/camel-api/src/main/java/org/apache/camel/support/ServiceSupport.java#L90
> Context MBean not unregistered on startup failure
> -------------------------------------------------
>
> Key: CAMEL-13094
> URL: https://issues.apache.org/jira/browse/CAMEL-13094
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.23.0
> Reporter: Thomas Diesler
> Priority: Major
> Fix For: 3.0.0
>
>
> In Camel-2.23.x a failure to start the context would call
> ServiceSupport.doStop(). This is no longer the case. Instead, a
> CamelContextStartupFailureEvent is thrown and services that might previously
> have been started are never stopped.
> As a result or (side effect) the context MBean may remain registered if the
> startup failure occurred after its initial registration.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)