ARTEMIS-2749 - Broadcast Group Control Improvements

added some default behaviour for when overridden

https://issues.apache.org/jira/browse/ARTEMIS-2749
This commit is contained in:
Andy Taylor 2020-05-07 14:19:51 +01:00 committed by Justin Bertram
parent 5d19ae9536
commit 5737f965d2
4 changed files with 118 additions and 2 deletions

View File

@ -42,6 +42,12 @@ public class BaseBroadcastGroupControlImpl extends AbstractControl implements Ba
// Constructors --------------------------------------------------
public BaseBroadcastGroupControlImpl(final BroadcastGroup broadcastGroup,
final StorageManager storageManager,
final BroadcastGroupConfiguration configuration) throws Exception {
this(BaseBroadcastGroupControl.class, broadcastGroup, storageManager, configuration);
}
public BaseBroadcastGroupControlImpl(final Class broadcastGroupControlClass,
final BroadcastGroup broadcastGroup,
final StorageManager storageManager,

View File

@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.core.management.impl;
import org.apache.activemq.artemis.api.core.management.Attribute;
import org.apache.activemq.artemis.api.core.management.JGroupsChannelBroadcastGroupControl;
public interface JGroupsPropertiesBroadcastGroupControl extends JGroupsChannelBroadcastGroupControl {
/**
* Returns the JGroups properties
*/
@Attribute(desc = "Returns the JGroups properties")
String getProperties();
}

View File

@ -0,0 +1,71 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.core.management.impl;
import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration;
import org.apache.activemq.artemis.api.core.JGroupsPropertiesBroadcastEndpointFactory;
import org.apache.activemq.artemis.api.core.management.JGroupsChannelBroadcastGroupControl;
import org.apache.activemq.artemis.core.persistence.StorageManager;
import org.apache.activemq.artemis.core.server.cluster.BroadcastGroup;
import org.apache.activemq.artemis.logs.AuditLogger;
public class JGroupsPropertiesBroadcastGroupControlImpl extends BaseBroadcastGroupControlImpl implements JGroupsPropertiesBroadcastGroupControl {
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
private JGroupsPropertiesBroadcastEndpointFactory endpointFactory;
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
public JGroupsPropertiesBroadcastGroupControlImpl(final BroadcastGroup broadcastGroup,
final StorageManager storageManager,
final BroadcastGroupConfiguration configuration,
final JGroupsPropertiesBroadcastEndpointFactory endpointFactory) throws Exception {
super(JGroupsChannelBroadcastGroupControl.class, broadcastGroup, storageManager, configuration);
this.endpointFactory = endpointFactory;
}
// BroadcastGroupControlMBean implementation ---------------------
@Override
public String getChannelName() throws Exception {
if (AuditLogger.isEnabled()) {
AuditLogger.getChannelName(this.endpointFactory.getChannelName());
}
return endpointFactory.getChannelName();
}
@Override
public String getProperties() {
return endpointFactory.getProperties();
}
// Public --------------------------------------------------------
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
}

View File

@ -39,6 +39,7 @@ import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration;
import org.apache.activemq.artemis.api.core.ChannelBroadcastEndpointFactory;
import org.apache.activemq.artemis.api.core.ICoreMessage;
import org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpointFactory;
import org.apache.activemq.artemis.api.core.JGroupsPropertiesBroadcastEndpointFactory;
import org.apache.activemq.artemis.api.core.JsonUtil;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.RoutingType;
@ -60,12 +61,14 @@ import org.apache.activemq.artemis.core.config.DivertConfiguration;
import org.apache.activemq.artemis.core.management.impl.AcceptorControlImpl;
import org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl;
import org.apache.activemq.artemis.core.management.impl.AddressControlImpl;
import org.apache.activemq.artemis.core.management.impl.BaseBroadcastGroupControlImpl;
import org.apache.activemq.artemis.core.management.impl.BridgeControlImpl;
import org.apache.activemq.artemis.core.management.impl.BroadcastGroupControlImpl;
import org.apache.activemq.artemis.core.management.impl.ClusterConnectionControlImpl;
import org.apache.activemq.artemis.core.management.impl.DivertControlImpl;
import org.apache.activemq.artemis.core.management.impl.JGroupsChannelBroadcastGroupControlImpl;
import org.apache.activemq.artemis.core.management.impl.JGroupsFileBroadcastGroupControlImpl;
import org.apache.activemq.artemis.core.management.impl.JGroupsPropertiesBroadcastGroupControlImpl;
import org.apache.activemq.artemis.core.management.impl.QueueControlImpl;
import org.apache.activemq.artemis.core.message.impl.CoreMessage;
import org.apache.activemq.artemis.core.messagecounter.MessageCounter;
@ -353,9 +356,16 @@ public class ManagementServiceImpl implements ManagementService {
control = new JGroupsFileBroadcastGroupControlImpl(broadcastGroup, storageManager, configuration, (JGroupsFileBroadcastEndpointFactory) endpointFactory);
} else if (endpointFactory instanceof ChannelBroadcastEndpointFactory) {
control = new JGroupsChannelBroadcastGroupControlImpl(broadcastGroup, storageManager, configuration, (ChannelBroadcastEndpointFactory) endpointFactory);
} else if (endpointFactory instanceof JGroupsPropertiesBroadcastEndpointFactory) {
control = new JGroupsPropertiesBroadcastGroupControlImpl(broadcastGroup, storageManager, configuration, (JGroupsPropertiesBroadcastEndpointFactory) endpointFactory);
} else {
control = new BaseBroadcastGroupControlImpl(broadcastGroup, storageManager, configuration);
}
//shouldnt ever be null
if (control != null) {
registerInJMX(objectName, control);
registerInRegistry(ResourceNames.BROADCAST_GROUP + configuration.getName(), control);
}
registerInJMX(objectName, control);
registerInRegistry(ResourceNames.BROADCAST_GROUP + configuration.getName(), control);
}
@Override