This closes #3396
This commit is contained in:
commit
de603ceba2
|
@ -37,6 +37,12 @@ public interface ActivateCallback {
|
||||||
default void deActivate() {
|
default void deActivate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* this is called when the server is stopping, before any resources or clients are closed/stopped
|
||||||
|
*/
|
||||||
|
default void preDeActivate() {
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this is called when all resources have been started including any JMS resources
|
* this is called when all resources have been started including any JMS resources
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1459,8 +1459,8 @@ public interface ActiveMQServerLogger extends BasicLogger {
|
||||||
void unableDestroyConnectionWithSessionMetadata(@Cause Throwable e);
|
void unableDestroyConnectionWithSessionMetadata(@Cause Throwable e);
|
||||||
|
|
||||||
@LogMessage(level = Logger.Level.WARN)
|
@LogMessage(level = Logger.Level.WARN)
|
||||||
@Message(id = 222234, value = "Unable to deactivate a callback", format = Message.Format.MESSAGE_FORMAT)
|
@Message(id = 222234, value = "Unable to invoke a callback", format = Message.Format.MESSAGE_FORMAT)
|
||||||
void unableToDeactiveCallback(@Cause Throwable e);
|
void unableToInvokeCallback(@Cause Throwable e);
|
||||||
|
|
||||||
@LogMessage(level = Logger.Level.WARN)
|
@LogMessage(level = Logger.Level.WARN)
|
||||||
@Message(id = 222235, value = "Unable to inject a monitor", format = Message.Format.MESSAGE_FORMAT)
|
@Message(id = 222235, value = "Unable to inject a monitor", format = Message.Format.MESSAGE_FORMAT)
|
||||||
|
|
|
@ -1186,6 +1186,8 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
||||||
}
|
}
|
||||||
state = SERVER_STATE.STOPPING;
|
state = SERVER_STATE.STOPPING;
|
||||||
|
|
||||||
|
callPreDeActiveCallbacks();
|
||||||
|
|
||||||
if (criticalIOError) {
|
if (criticalIOError) {
|
||||||
final ManagementService managementService = this.managementService;
|
final ManagementService managementService = this.managementService;
|
||||||
if (managementService != null) {
|
if (managementService != null) {
|
||||||
|
@ -2899,7 +2901,18 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// https://bugzilla.redhat.com/show_bug.cgi?id=1009530:
|
// https://bugzilla.redhat.com/show_bug.cgi?id=1009530:
|
||||||
// we won't interrupt the shutdown sequence because of a failed callback here
|
// we won't interrupt the shutdown sequence because of a failed callback here
|
||||||
ActiveMQServerLogger.LOGGER.unableToDeactiveCallback(e);
|
ActiveMQServerLogger.LOGGER.unableToInvokeCallback(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void callPreDeActiveCallbacks() {
|
||||||
|
for (ActivateCallback callback : activateCallbacks) {
|
||||||
|
try {
|
||||||
|
callback.preDeActivate();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
// we won't interrupt the shutdown sequence because of a failed callback here
|
||||||
|
ActiveMQServerLogger.LOGGER.unableToInvokeCallback(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue