Skip to content

Commit

Permalink
ARTEMIS-2749 - Broadcast Group Control Improvements
Browse files Browse the repository at this point in the history
added some default behaviour for when overridden

https://issues.apache.org/jira/browse/ARTEMIS-2749
  • Loading branch information
andytaylor authored and jbertram committed May 11, 2020
1 parent 5d19ae9 commit 5737f96
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 2 deletions.
Expand Up @@ -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,
Expand Down
@@ -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();
}
@@ -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 -------------------------------------------------

}
Expand Up @@ -39,6 +39,7 @@
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;
Expand All @@ -60,12 +61,14 @@
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;
Expand Down Expand Up @@ -353,9 +356,16 @@ public synchronized void registerBroadcastGroup(final BroadcastGroup broadcastGr
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
Expand Down

0 comments on commit 5737f96

Please sign in to comment.