jbertram commented on code in PR #4996:
URL: https://github.com/apache/activemq-artemis/pull/4996#discussion_r1676449918
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java:
##########
@@ -363,49 +355,43 @@ public Executor getExecutor() {
}
@Override
- public void stop() throws Exception {
- if (stopping) {
- return;
+ public synchronized void stop() throws Exception {
+ if (state == State.STOPPING || state == State.STOPPED || state ==
State.PAUSING) {
+ logger.debug("Bridge {} state is {}. Ignoring call to stop.",
configuration.getName(), state);
+ if (state == State.PAUSING) {
+ throw
ActiveMQMessageBundle.BUNDLE.bridgeOperationCannotBeExecuted(configuration.getName(),
"stopped", state);
+ } else {
+ return;
+ }
}
- stopping = true;
+ state = State.STOPPING;
- logger.debug("Bridge {} being stopped", configuration.getName());
+ logger.debug("Bridge {} is stopping", configuration.getName());
- if (futureScheduledReconnection != null) {
- futureScheduledReconnection.cancel(true);
+ if (scheduledReconnection != null) {
+ scheduledReconnection.cancel(true);
}
executor.execute(new StopRunnable());
+ }
- if (notificationService != null) {
- TypedProperties props = new TypedProperties();
- props.putSimpleStringProperty(SimpleString.of("name"),
SimpleString.of(configuration.getName()));
- Notification notification = new Notification(nodeUUID.toString(),
CoreNotificationType.BRIDGE_STOPPED, props);
- try {
- notificationService.sendNotification(notification);
- } catch (Exception e) {
- ActiveMQServerLogger.LOGGER.broadcastBridgeStoppedError(e);
+ @Override
+ public synchronized void pause() throws Exception {
+ if (state == State.STOPPING || state == State.STOPPED || state ==
State.PAUSING || state == State.PAUSED) {
+ logger.debug("Bridge {} state is {}. Ignoring call to pause.",
configuration.getName(), state);
+ if (state == State.STOPPING || state == State.STOPPED) {
+ throw
ActiveMQMessageBundle.BUNDLE.bridgeOperationCannotBeExecuted(configuration.getName(),
"paused", state);
+ } else {
+ return;
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact