You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/08/10 17:13:11 UTC
[12/53] [abbrv] [partial] activemq-artemis git commit: automatic
checkstyle change
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSConnectionFactoryControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSConnectionFactoryControlImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSConnectionFactoryControlImpl.java
index 59ecd3e..efa1df5 100644
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSConnectionFactoryControlImpl.java
+++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSConnectionFactoryControlImpl.java
@@ -29,8 +29,7 @@ import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.server.JMSServerManager;
import org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration;
-public class JMSConnectionFactoryControlImpl extends StandardMBean implements ConnectionFactoryControl
-{
+public class JMSConnectionFactoryControlImpl extends StandardMBean implements ConnectionFactoryControl {
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
@@ -50,8 +49,7 @@ public class JMSConnectionFactoryControlImpl extends StandardMBean implements Co
public JMSConnectionFactoryControlImpl(final ConnectionFactoryConfiguration cfConfig,
final ActiveMQConnectionFactory cf,
final JMSServerManager jmsManager,
- final String name) throws NotCompliantMBeanException
- {
+ final String name) throws NotCompliantMBeanException {
super(ConnectionFactoryControl.class);
this.cfConfig = cfConfig;
this.cf = cf;
@@ -63,405 +61,327 @@ public class JMSConnectionFactoryControlImpl extends StandardMBean implements Co
// ManagedConnectionFactoryMBean implementation ------------------
- public String[] getRegistryBindings()
- {
+ public String[] getRegistryBindings() {
return jmsManager.getBindingsOnConnectionFactory(name);
}
- public boolean isCompressLargeMessages()
- {
+ public boolean isCompressLargeMessages() {
return cf.isCompressLargeMessage();
}
- public void setCompressLargeMessages(final boolean compress)
- {
+ public void setCompressLargeMessages(final boolean compress) {
cfConfig.setCompressLargeMessages(compress);
recreateCF();
}
- public boolean isHA()
- {
+ public boolean isHA() {
return cfConfig.isHA();
}
- public int getFactoryType()
- {
+ public int getFactoryType() {
return cfConfig.getFactoryType().intValue();
}
- public String getClientID()
- {
+ public String getClientID() {
return cfConfig.getClientID();
}
- public long getClientFailureCheckPeriod()
- {
+ public long getClientFailureCheckPeriod() {
return cfConfig.getClientFailureCheckPeriod();
}
- public void setClientID(String clientID)
- {
+ public void setClientID(String clientID) {
cfConfig.setClientID(clientID);
recreateCF();
}
- public void setDupsOKBatchSize(int dupsOKBatchSize)
- {
+ public void setDupsOKBatchSize(int dupsOKBatchSize) {
cfConfig.setDupsOKBatchSize(dupsOKBatchSize);
recreateCF();
}
- public void setTransactionBatchSize(int transactionBatchSize)
- {
+ public void setTransactionBatchSize(int transactionBatchSize) {
cfConfig.setTransactionBatchSize(transactionBatchSize);
recreateCF();
}
- public void setClientFailureCheckPeriod(long clientFailureCheckPeriod)
- {
+ public void setClientFailureCheckPeriod(long clientFailureCheckPeriod) {
cfConfig.setClientFailureCheckPeriod(clientFailureCheckPeriod);
recreateCF();
}
- public void setConnectionTTL(long connectionTTL)
- {
+ public void setConnectionTTL(long connectionTTL) {
cfConfig.setConnectionTTL(connectionTTL);
recreateCF();
}
- public void setCallTimeout(long callTimeout)
- {
+ public void setCallTimeout(long callTimeout) {
cfConfig.setCallTimeout(callTimeout);
recreateCF();
}
- public void setCallFailoverTimeout(long callTimeout)
- {
+ public void setCallFailoverTimeout(long callTimeout) {
cfConfig.setCallFailoverTimeout(callTimeout);
recreateCF();
}
- public void setConsumerWindowSize(int consumerWindowSize)
- {
+ public void setConsumerWindowSize(int consumerWindowSize) {
cfConfig.setConsumerWindowSize(consumerWindowSize);
recreateCF();
}
- public void setConsumerMaxRate(int consumerMaxRate)
- {
+ public void setConsumerMaxRate(int consumerMaxRate) {
cfConfig.setConsumerMaxRate(consumerMaxRate);
recreateCF();
}
- public void setConfirmationWindowSize(int confirmationWindowSize)
- {
+ public void setConfirmationWindowSize(int confirmationWindowSize) {
cfConfig.setConfirmationWindowSize(confirmationWindowSize);
recreateCF();
}
- public void setProducerMaxRate(int producerMaxRate)
- {
+ public void setProducerMaxRate(int producerMaxRate) {
cfConfig.setProducerMaxRate(producerMaxRate);
recreateCF();
}
- public int getProducerWindowSize()
- {
+ public int getProducerWindowSize() {
return cfConfig.getProducerWindowSize();
}
- public void setProducerWindowSize(int producerWindowSize)
- {
+ public void setProducerWindowSize(int producerWindowSize) {
cfConfig.setProducerWindowSize(producerWindowSize);
recreateCF();
}
- public void setCacheLargeMessagesClient(boolean cacheLargeMessagesClient)
- {
+ public void setCacheLargeMessagesClient(boolean cacheLargeMessagesClient) {
cfConfig.setCacheLargeMessagesClient(cacheLargeMessagesClient);
recreateCF();
}
- public boolean isCacheLargeMessagesClient()
- {
+ public boolean isCacheLargeMessagesClient() {
return cfConfig.isCacheLargeMessagesClient();
}
- public void setMinLargeMessageSize(int minLargeMessageSize)
- {
+ public void setMinLargeMessageSize(int minLargeMessageSize) {
cfConfig.setMinLargeMessageSize(minLargeMessageSize);
recreateCF();
}
- public void setBlockOnNonDurableSend(boolean blockOnNonDurableSend)
- {
+ public void setBlockOnNonDurableSend(boolean blockOnNonDurableSend) {
cfConfig.setBlockOnNonDurableSend(blockOnNonDurableSend);
recreateCF();
}
- public void setBlockOnAcknowledge(boolean blockOnAcknowledge)
- {
+ public void setBlockOnAcknowledge(boolean blockOnAcknowledge) {
cfConfig.setBlockOnAcknowledge(blockOnAcknowledge);
recreateCF();
}
- public void setBlockOnDurableSend(boolean blockOnDurableSend)
- {
+ public void setBlockOnDurableSend(boolean blockOnDurableSend) {
cfConfig.setBlockOnDurableSend(blockOnDurableSend);
recreateCF();
}
- public void setAutoGroup(boolean autoGroup)
- {
+ public void setAutoGroup(boolean autoGroup) {
cfConfig.setAutoGroup(autoGroup);
recreateCF();
}
- public void setPreAcknowledge(boolean preAcknowledge)
- {
+ public void setPreAcknowledge(boolean preAcknowledge) {
cfConfig.setPreAcknowledge(preAcknowledge);
recreateCF();
}
- public void setMaxRetryInterval(long retryInterval)
- {
+ public void setMaxRetryInterval(long retryInterval) {
cfConfig.setMaxRetryInterval(retryInterval);
recreateCF();
}
- public void setRetryIntervalMultiplier(double retryIntervalMultiplier)
- {
+ public void setRetryIntervalMultiplier(double retryIntervalMultiplier) {
cfConfig.setRetryIntervalMultiplier(retryIntervalMultiplier);
recreateCF();
}
- public void setReconnectAttempts(int reconnectAttempts)
- {
+ public void setReconnectAttempts(int reconnectAttempts) {
cfConfig.setReconnectAttempts(reconnectAttempts);
recreateCF();
}
- public void setFailoverOnInitialConnection(boolean failover)
- {
+ public void setFailoverOnInitialConnection(boolean failover) {
cfConfig.setFailoverOnInitialConnection(failover);
recreateCF();
}
- public boolean isUseGlobalPools()
- {
+ public boolean isUseGlobalPools() {
return cfConfig.isUseGlobalPools();
}
- public void setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize)
- {
+ public void setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize) {
cfConfig.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
recreateCF();
}
- public int getThreadPoolMaxSize()
- {
+ public int getThreadPoolMaxSize() {
return cfConfig.getThreadPoolMaxSize();
}
- public void setThreadPoolMaxSize(int threadPoolMaxSize)
- {
+ public void setThreadPoolMaxSize(int threadPoolMaxSize) {
cfConfig.setThreadPoolMaxSize(threadPoolMaxSize);
recreateCF();
}
- public int getInitialMessagePacketSize()
- {
+ public int getInitialMessagePacketSize() {
return cf.getInitialMessagePacketSize();
}
- public void setGroupID(String groupID)
- {
+ public void setGroupID(String groupID) {
cfConfig.setGroupID(groupID);
recreateCF();
}
- public String getGroupID()
- {
+ public String getGroupID() {
return cfConfig.getGroupID();
}
- public void setUseGlobalPools(boolean useGlobalPools)
- {
+ public void setUseGlobalPools(boolean useGlobalPools) {
cfConfig.setUseGlobalPools(useGlobalPools);
recreateCF();
}
- public int getScheduledThreadPoolMaxSize()
- {
+ public int getScheduledThreadPoolMaxSize() {
return cfConfig.getScheduledThreadPoolMaxSize();
}
- public void setRetryInterval(long retryInterval)
- {
+ public void setRetryInterval(long retryInterval) {
cfConfig.setRetryInterval(retryInterval);
recreateCF();
}
- public long getMaxRetryInterval()
- {
+ public long getMaxRetryInterval() {
return cfConfig.getMaxRetryInterval();
}
- public String getConnectionLoadBalancingPolicyClassName()
- {
+ public String getConnectionLoadBalancingPolicyClassName() {
return cfConfig.getLoadBalancingPolicyClassName();
}
- public void setConnectionLoadBalancingPolicyClassName(String name)
- {
+ public void setConnectionLoadBalancingPolicyClassName(String name) {
cfConfig.setLoadBalancingPolicyClassName(name);
recreateCF();
}
- public TransportConfiguration[] getStaticConnectors()
- {
+ public TransportConfiguration[] getStaticConnectors() {
return cf.getStaticConnectors();
}
- public DiscoveryGroupConfiguration getDiscoveryGroupConfiguration()
- {
+ public DiscoveryGroupConfiguration getDiscoveryGroupConfiguration() {
return cf.getDiscoveryGroupConfiguration();
}
- public void addBinding(@Parameter(name = "binding", desc = "the name of the binding for the Registry") String binding) throws Exception
- {
+ public void addBinding(@Parameter(name = "binding", desc = "the name of the binding for the Registry") String binding) throws Exception {
jmsManager.addConnectionFactoryToBindingRegistry(name, binding);
}
- public void removeBinding(@Parameter(name = "binding", desc = "the name of the binding for the Registry") String binding) throws Exception
- {
+ public void removeBinding(@Parameter(name = "binding", desc = "the name of the binding for the Registry") String binding) throws Exception {
jmsManager.removeConnectionFactoryFromBindingRegistry(name, binding);
}
- public long getCallTimeout()
- {
+ public long getCallTimeout() {
return cfConfig.getCallTimeout();
}
- public long getCallFailoverTimeout()
- {
+ public long getCallFailoverTimeout() {
return cfConfig.getCallFailoverTimeout();
}
- public int getConsumerMaxRate()
- {
+ public int getConsumerMaxRate() {
return cfConfig.getConsumerMaxRate();
}
- public int getConsumerWindowSize()
- {
+ public int getConsumerWindowSize() {
return cfConfig.getConsumerWindowSize();
}
- public int getProducerMaxRate()
- {
+ public int getProducerMaxRate() {
return cfConfig.getProducerMaxRate();
}
- public int getConfirmationWindowSize()
- {
+ public int getConfirmationWindowSize() {
return cfConfig.getConfirmationWindowSize();
}
- public int getDupsOKBatchSize()
- {
+ public int getDupsOKBatchSize() {
return cfConfig.getDupsOKBatchSize();
}
- public boolean isBlockOnAcknowledge()
- {
+ public boolean isBlockOnAcknowledge() {
return cfConfig.isBlockOnAcknowledge();
}
- public boolean isBlockOnNonDurableSend()
- {
+ public boolean isBlockOnNonDurableSend() {
return cfConfig.isBlockOnNonDurableSend();
}
- public boolean isBlockOnDurableSend()
- {
+ public boolean isBlockOnDurableSend() {
return cfConfig.isBlockOnDurableSend();
}
- public boolean isPreAcknowledge()
- {
+ public boolean isPreAcknowledge() {
return cfConfig.isPreAcknowledge();
}
- public String getName()
- {
+ public String getName() {
return name;
}
- public long getConnectionTTL()
- {
+ public long getConnectionTTL() {
return cfConfig.getConnectionTTL();
}
- public int getReconnectAttempts()
- {
+ public int getReconnectAttempts() {
return cfConfig.getReconnectAttempts();
}
- public boolean isFailoverOnInitialConnection()
- {
+ public boolean isFailoverOnInitialConnection() {
return cfConfig.isFailoverOnInitialConnection();
}
- public int getMinLargeMessageSize()
- {
+ public int getMinLargeMessageSize() {
return cfConfig.getMinLargeMessageSize();
}
- public long getRetryInterval()
- {
+ public long getRetryInterval() {
return cfConfig.getRetryInterval();
}
- public double getRetryIntervalMultiplier()
- {
+ public double getRetryIntervalMultiplier() {
return cfConfig.getRetryIntervalMultiplier();
}
- public int getTransactionBatchSize()
- {
+ public int getTransactionBatchSize() {
return cfConfig.getTransactionBatchSize();
}
- public boolean isAutoGroup()
- {
+ public boolean isAutoGroup() {
return cfConfig.isAutoGroup();
}
@Override
- public MBeanInfo getMBeanInfo()
- {
+ public MBeanInfo getMBeanInfo() {
MBeanInfo info = super.getMBeanInfo();
- return new MBeanInfo(info.getClassName(),
- info.getDescription(),
- info.getAttributes(),
- info.getConstructors(),
- MBeanInfoHelper.getMBeanOperationsInfo(ConnectionFactoryControl.class),
- info.getNotifications());
+ return new MBeanInfo(info.getClassName(), info.getDescription(), info.getAttributes(), info.getConstructors(), MBeanInfoHelper.getMBeanOperationsInfo(ConnectionFactoryControl.class), info.getNotifications());
}
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
- private void recreateCF()
- {
- try
- {
+ private void recreateCF() {
+ try {
this.cf = jmsManager.recreateCF(this.name, this.cfConfig);
}
- catch (Exception e)
- {
+ catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSQueueControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSQueueControlImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSQueueControlImpl.java
index dd255f5..ed2d922 100644
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSQueueControlImpl.java
+++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSQueueControlImpl.java
@@ -37,8 +37,8 @@ import org.apache.activemq.artemis.jms.server.JMSServerManager;
import org.apache.activemq.artemis.utils.json.JSONArray;
import org.apache.activemq.artemis.utils.json.JSONObject;
-public class JMSQueueControlImpl extends StandardMBean implements JMSQueueControl
-{
+public class JMSQueueControlImpl extends StandardMBean implements JMSQueueControl {
+
private final ActiveMQDestination managedQueue;
private final JMSServerManager jmsServerManager;
@@ -52,22 +52,17 @@ public class JMSQueueControlImpl extends StandardMBean implements JMSQueueContro
/**
* Returns null if the string is null or empty
*/
- public static String createFilterFromJMSSelector(final String selectorStr) throws ActiveMQException
- {
- return selectorStr == null || selectorStr.trim().length() == 0 ? null
- : SelectorTranslator.convertToActiveMQFilterString(selectorStr);
+ public static String createFilterFromJMSSelector(final String selectorStr) throws ActiveMQException {
+ return selectorStr == null || selectorStr.trim().length() == 0 ? null : SelectorTranslator.convertToActiveMQFilterString(selectorStr);
}
- private static String createFilterForJMSMessageID(final String jmsMessageID) throws Exception
- {
+ private static String createFilterForJMSMessageID(final String jmsMessageID) throws Exception {
return FilterConstants.ACTIVEMQ_USERID + " = '" + jmsMessageID + "'";
}
- static String toJSON(final Map<String, Object>[] messages)
- {
+ static String toJSON(final Map<String, Object>[] messages) {
JSONArray array = new JSONArray();
- for (Map<String, Object> message : messages)
- {
+ for (Map<String, Object> message : messages) {
array.put(new JSONObject(message));
}
return array.toString();
@@ -78,8 +73,7 @@ public class JMSQueueControlImpl extends StandardMBean implements JMSQueueContro
public JMSQueueControlImpl(final ActiveMQDestination managedQueue,
final QueueControl coreQueueControl,
final JMSServerManager jmsServerManager,
- final MessageCounter counter) throws Exception
- {
+ final MessageCounter counter) throws Exception {
super(JMSQueueControl.class);
this.managedQueue = managedQueue;
this.jmsServerManager = jmsServerManager;
@@ -91,127 +85,103 @@ public class JMSQueueControlImpl extends StandardMBean implements JMSQueueContro
// ManagedJMSQueueMBean implementation ---------------------------
- public String getName()
- {
+ public String getName() {
return managedQueue.getName();
}
- public String getAddress()
- {
+ public String getAddress() {
return managedQueue.getAddress();
}
- public boolean isTemporary()
- {
+ public boolean isTemporary() {
return managedQueue.isTemporary();
}
- public long getMessageCount()
- {
+ public long getMessageCount() {
return coreQueueControl.getMessageCount();
}
- public long getMessagesAdded()
- {
+ public long getMessagesAdded() {
return coreQueueControl.getMessagesAdded();
}
- public int getConsumerCount()
- {
+ public int getConsumerCount() {
return coreQueueControl.getConsumerCount();
}
- public int getDeliveringCount()
- {
+ public int getDeliveringCount() {
return coreQueueControl.getDeliveringCount();
}
- public long getScheduledCount()
- {
+ public long getScheduledCount() {
return coreQueueControl.getScheduledCount();
}
- public boolean isDurable()
- {
+ public boolean isDurable() {
return coreQueueControl.isDurable();
}
- public String getDeadLetterAddress()
- {
+ public String getDeadLetterAddress() {
return coreQueueControl.getDeadLetterAddress();
}
- public String getExpiryAddress()
- {
+ public String getExpiryAddress() {
return coreQueueControl.getExpiryAddress();
}
- public String getFirstMessageAsJSON() throws Exception
- {
+ public String getFirstMessageAsJSON() throws Exception {
return coreQueueControl.getFirstMessageAsJSON();
}
- public Long getFirstMessageTimestamp() throws Exception
- {
+ public Long getFirstMessageTimestamp() throws Exception {
return coreQueueControl.getFirstMessageTimestamp();
}
- public Long getFirstMessageAge() throws Exception
- {
+ public Long getFirstMessageAge() throws Exception {
return coreQueueControl.getFirstMessageAge();
}
@Override
- public void addBinding(String binding) throws Exception
- {
+ public void addBinding(String binding) throws Exception {
jmsServerManager.addQueueToBindingRegistry(managedQueue.getName(), binding);
}
- public String[] getRegistryBindings()
- {
+ public String[] getRegistryBindings() {
return jmsServerManager.getBindingsOnQueue(managedQueue.getName());
}
- public boolean removeMessage(final String messageID) throws Exception
- {
+ public boolean removeMessage(final String messageID) throws Exception {
String filter = JMSQueueControlImpl.createFilterForJMSMessageID(messageID);
int removed = coreQueueControl.removeMessages(filter);
- if (removed != 1)
- {
+ if (removed != 1) {
throw new IllegalArgumentException("No message found for JMSMessageID: " + messageID);
}
return true;
}
- public int removeMessages(final String filterStr) throws Exception
- {
+ public int removeMessages(final String filterStr) throws Exception {
String filter = JMSQueueControlImpl.createFilterFromJMSSelector(filterStr);
return coreQueueControl.removeMessages(filter);
}
- public Map<String, Object>[] listMessages(final String filterStr) throws Exception
- {
- try
- {
+ public Map<String, Object>[] listMessages(final String filterStr) throws Exception {
+ try {
String filter = JMSQueueControlImpl.createFilterFromJMSSelector(filterStr);
Map<String, Object>[] coreMessages = coreQueueControl.listMessages(filter);
return toJMSMap(coreMessages);
}
- catch (ActiveMQException e)
- {
+ catch (ActiveMQException e) {
throw new IllegalStateException(e.getMessage());
}
}
- private Map<String, Object>[] toJMSMap(Map<String, Object>[] coreMessages)
- {
+ private Map<String, Object>[] toJMSMap(Map<String, Object>[] coreMessages) {
Map<String, Object>[] jmsMessages = new Map[coreMessages.length];
int i = 0;
- for (Map<String, Object> coreMessage : coreMessages)
- {
+ for (Map<String, Object> coreMessage : coreMessages) {
Map<String, Object> jmsMessage = ActiveMQMessage.coreMaptoJMSMap(coreMessage);
jmsMessages[i++] = jmsMessage;
}
@@ -219,215 +189,175 @@ public class JMSQueueControlImpl extends StandardMBean implements JMSQueueContro
}
@Override
- public Map<String, Object>[] listScheduledMessages() throws Exception
- {
+ public Map<String, Object>[] listScheduledMessages() throws Exception {
Map<String, Object>[] coreMessages = coreQueueControl.listScheduledMessages();
return toJMSMap(coreMessages);
}
@Override
- public String listScheduledMessagesAsJSON() throws Exception
- {
+ public String listScheduledMessagesAsJSON() throws Exception {
return coreQueueControl.listScheduledMessagesAsJSON();
}
@Override
- public Map<String, Map<String, Object>[]> listDeliveringMessages() throws Exception
- {
- try
- {
+ public Map<String, Map<String, Object>[]> listDeliveringMessages() throws Exception {
+ try {
Map<String, Map<String, Object>[]> returnMap = new HashMap<String, Map<String, Object>[]>();
-
// the workingMap from the queue-control
Map<String, Map<String, Object>[]> workingMap = coreQueueControl.listDeliveringMessages();
- for (Map.Entry<String, Map<String, Object>[]> entry : workingMap.entrySet())
- {
+ for (Map.Entry<String, Map<String, Object>[]> entry : workingMap.entrySet()) {
returnMap.put(entry.getKey(), toJMSMap(entry.getValue()));
}
return returnMap;
}
- catch (ActiveMQException e)
- {
+ catch (ActiveMQException e) {
throw new IllegalStateException(e.getMessage());
}
}
@Override
- public String listDeliveringMessagesAsJSON() throws Exception
- {
+ public String listDeliveringMessagesAsJSON() throws Exception {
return coreQueueControl.listDeliveringMessagesAsJSON();
}
- public String listMessagesAsJSON(final String filter) throws Exception
- {
+ public String listMessagesAsJSON(final String filter) throws Exception {
return JMSQueueControlImpl.toJSON(listMessages(filter));
}
- public long countMessages(final String filterStr) throws Exception
- {
+ public long countMessages(final String filterStr) throws Exception {
String filter = JMSQueueControlImpl.createFilterFromJMSSelector(filterStr);
return coreQueueControl.countMessages(filter);
}
- public boolean expireMessage(final String messageID) throws Exception
- {
+ public boolean expireMessage(final String messageID) throws Exception {
String filter = JMSQueueControlImpl.createFilterForJMSMessageID(messageID);
int expired = coreQueueControl.expireMessages(filter);
- if (expired != 1)
- {
+ if (expired != 1) {
throw new IllegalArgumentException("No message found for JMSMessageID: " + messageID);
}
return true;
}
- public int expireMessages(final String filterStr) throws Exception
- {
+ public int expireMessages(final String filterStr) throws Exception {
String filter = JMSQueueControlImpl.createFilterFromJMSSelector(filterStr);
return coreQueueControl.expireMessages(filter);
}
- public boolean sendMessageToDeadLetterAddress(final String messageID) throws Exception
- {
+ public boolean sendMessageToDeadLetterAddress(final String messageID) throws Exception {
String filter = JMSQueueControlImpl.createFilterForJMSMessageID(messageID);
int dead = coreQueueControl.sendMessagesToDeadLetterAddress(filter);
- if (dead != 1)
- {
+ if (dead != 1) {
throw new IllegalArgumentException("No message found for JMSMessageID: " + messageID);
}
return true;
}
- public int sendMessagesToDeadLetterAddress(final String filterStr) throws Exception
- {
+ public int sendMessagesToDeadLetterAddress(final String filterStr) throws Exception {
String filter = JMSQueueControlImpl.createFilterFromJMSSelector(filterStr);
return coreQueueControl.sendMessagesToDeadLetterAddress(filter);
}
- public boolean changeMessagePriority(final String messageID, final int newPriority) throws Exception
- {
+ public boolean changeMessagePriority(final String messageID, final int newPriority) throws Exception {
String filter = JMSQueueControlImpl.createFilterForJMSMessageID(messageID);
int changed = coreQueueControl.changeMessagesPriority(filter, newPriority);
- if (changed != 1)
- {
+ if (changed != 1) {
throw new IllegalArgumentException("No message found for JMSMessageID: " + messageID);
}
return true;
}
- public int changeMessagesPriority(final String filterStr, final int newPriority) throws Exception
- {
+ public int changeMessagesPriority(final String filterStr, final int newPriority) throws Exception {
String filter = JMSQueueControlImpl.createFilterFromJMSSelector(filterStr);
return coreQueueControl.changeMessagesPriority(filter, newPriority);
}
- public boolean moveMessage(final String messageID, final String otherQueueName) throws Exception
- {
+ public boolean moveMessage(final String messageID, final String otherQueueName) throws Exception {
return moveMessage(messageID, otherQueueName, false);
}
- public boolean moveMessage(final String messageID, final String otherQueueName, final boolean rejectDuplicates) throws Exception
- {
+ public boolean moveMessage(final String messageID,
+ final String otherQueueName,
+ final boolean rejectDuplicates) throws Exception {
String filter = JMSQueueControlImpl.createFilterForJMSMessageID(messageID);
ActiveMQDestination otherQueue = ActiveMQDestination.createQueue(otherQueueName);
int moved = coreQueueControl.moveMessages(filter, otherQueue.getAddress(), rejectDuplicates);
- if (moved != 1)
- {
+ if (moved != 1) {
throw new IllegalArgumentException("No message found for JMSMessageID: " + messageID);
}
return true;
}
- public int moveMessages(final String filterStr, final String otherQueueName, final boolean rejectDuplicates) throws Exception
- {
+ public int moveMessages(final String filterStr,
+ final String otherQueueName,
+ final boolean rejectDuplicates) throws Exception {
String filter = JMSQueueControlImpl.createFilterFromJMSSelector(filterStr);
ActiveMQDestination otherQueue = ActiveMQDestination.createQueue(otherQueueName);
return coreQueueControl.moveMessages(filter, otherQueue.getAddress(), rejectDuplicates);
}
-
- public int moveMessages(final String filterStr, final String otherQueueName) throws Exception
- {
+ public int moveMessages(final String filterStr, final String otherQueueName) throws Exception {
return moveMessages(filterStr, otherQueueName, false);
}
@Operation(desc = "List all the existent consumers on the Queue")
- public String listConsumersAsJSON() throws Exception
- {
+ public String listConsumersAsJSON() throws Exception {
return coreQueueControl.listConsumersAsJSON();
}
- public String listMessageCounter()
- {
- try
- {
+ public String listMessageCounter() {
+ try {
return MessageCounterInfo.toJSon(counter);
}
- catch (Exception e)
- {
+ catch (Exception e) {
throw new IllegalStateException(e);
}
}
- public void resetMessageCounter() throws Exception
- {
+ public void resetMessageCounter() throws Exception {
coreQueueControl.resetMessageCounter();
}
- public String listMessageCounterAsHTML()
- {
+ public String listMessageCounterAsHTML() {
return MessageCounterHelper.listMessageCounterAsHTML(new MessageCounter[]{counter});
}
- public String listMessageCounterHistory() throws Exception
- {
+ public String listMessageCounterHistory() throws Exception {
return MessageCounterHelper.listMessageCounterHistory(counter);
}
- public String listMessageCounterHistoryAsHTML()
- {
+ public String listMessageCounterHistoryAsHTML() {
return MessageCounterHelper.listMessageCounterHistoryAsHTML(new MessageCounter[]{counter});
}
- public boolean isPaused() throws Exception
- {
+ public boolean isPaused() throws Exception {
return coreQueueControl.isPaused();
}
- public void pause() throws Exception
- {
+ public void pause() throws Exception {
coreQueueControl.pause();
}
- public void resume() throws Exception
- {
+ public void resume() throws Exception {
coreQueueControl.resume();
}
- public String getSelector()
- {
+ public String getSelector() {
return coreQueueControl.getFilter();
}
- public void flushExecutor()
- {
+ public void flushExecutor() {
coreQueueControl.flushExecutor();
}
@Override
- public MBeanInfo getMBeanInfo()
- {
+ public MBeanInfo getMBeanInfo() {
MBeanInfo info = super.getMBeanInfo();
- return new MBeanInfo(info.getClassName(),
- info.getDescription(),
- info.getAttributes(),
- info.getConstructors(),
- MBeanInfoHelper.getMBeanOperationsInfo(JMSQueueControl.class),
- info.getNotifications());
+ return new MBeanInfo(info.getClassName(), info.getDescription(), info.getAttributes(), info.getConstructors(), MBeanInfoHelper.getMBeanOperationsInfo(JMSQueueControl.class), info.getNotifications());
}
// Package protected ---------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java
index 9e50cc2..eacc91f 100644
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java
+++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java
@@ -57,9 +57,7 @@ import org.apache.activemq.artemis.utils.TypedProperties;
import org.apache.activemq.artemis.utils.json.JSONArray;
import org.apache.activemq.artemis.utils.json.JSONObject;
-public class JMSServerControlImpl extends AbstractControl implements JMSServerControl, NotificationEmitter,
- org.apache.activemq.artemis.core.server.management.NotificationListener
-{
+public class JMSServerControlImpl extends AbstractControl implements JMSServerControl, NotificationEmitter, org.apache.activemq.artemis.core.server.management.NotificationListener {
// Constants -----------------------------------------------------
@@ -73,57 +71,46 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
// Static --------------------------------------------------------
- private static String[] convert(final Object[] bindings)
- {
+ private static String[] convert(final Object[] bindings) {
String[] theBindings = new String[bindings.length];
- for (int i = 0, bindingsLength = bindings.length; i < bindingsLength; i++)
- {
+ for (int i = 0, bindingsLength = bindings.length; i < bindingsLength; i++) {
theBindings[i] = bindings[i].toString().trim();
}
return theBindings;
}
- private static String[] toArray(final String commaSeparatedString)
- {
- if (commaSeparatedString == null || commaSeparatedString.trim().length() == 0)
- {
+ private static String[] toArray(final String commaSeparatedString) {
+ if (commaSeparatedString == null || commaSeparatedString.trim().length() == 0) {
return new String[0];
}
String[] values = commaSeparatedString.split(",");
String[] trimmed = new String[values.length];
- for (int i = 0; i < values.length; i++)
- {
+ for (int i = 0; i < values.length; i++) {
trimmed[i] = values[i].trim();
trimmed[i] = trimmed[i].replace(",", ",");
}
return trimmed;
}
- private static String[] determineJMSDestination(String coreAddress)
- {
+ private static String[] determineJMSDestination(String coreAddress) {
String[] result = new String[2]; // destination name & type
- if (coreAddress.startsWith(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX))
- {
+ if (coreAddress.startsWith(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX)) {
result[0] = coreAddress.substring(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX.length());
result[1] = "queue";
}
- else if (coreAddress.startsWith(ActiveMQDestination.JMS_TEMP_QUEUE_ADDRESS_PREFIX))
- {
+ else if (coreAddress.startsWith(ActiveMQDestination.JMS_TEMP_QUEUE_ADDRESS_PREFIX)) {
result[0] = coreAddress.substring(ActiveMQDestination.JMS_TEMP_QUEUE_ADDRESS_PREFIX.length());
result[1] = "tempqueue";
}
- else if (coreAddress.startsWith(ActiveMQDestination.JMS_TOPIC_ADDRESS_PREFIX))
- {
+ else if (coreAddress.startsWith(ActiveMQDestination.JMS_TOPIC_ADDRESS_PREFIX)) {
result[0] = coreAddress.substring(ActiveMQDestination.JMS_TOPIC_ADDRESS_PREFIX.length());
result[1] = "topic";
}
- else if (coreAddress.startsWith(ActiveMQDestination.JMS_TEMP_TOPIC_ADDRESS_PREFIX))
- {
+ else if (coreAddress.startsWith(ActiveMQDestination.JMS_TEMP_TOPIC_ADDRESS_PREFIX)) {
result[0] = coreAddress.substring(ActiveMQDestination.JMS_TEMP_TOPIC_ADDRESS_PREFIX.length());
result[1] = "temptopic";
}
- else
- {
+ else {
ActiveMQJMSServerLogger.LOGGER.debug("JMSServerControlImpl.determineJMSDestination()" + coreAddress);
// not related to JMS
return null;
@@ -131,23 +118,18 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
return result;
}
- public static MBeanNotificationInfo[] getNotificationInfos()
- {
+ public static MBeanNotificationInfo[] getNotificationInfos() {
JMSNotificationType[] values = JMSNotificationType.values();
String[] names = new String[values.length];
- for (int i = 0; i < values.length; i++)
- {
+ for (int i = 0; i < values.length; i++) {
names[i] = values[i].toString();
}
- return new MBeanNotificationInfo[]{new MBeanNotificationInfo(names,
- JMSServerControl.class.getName(),
- "Notifications emitted by a JMS Server")};
+ return new MBeanNotificationInfo[]{new MBeanNotificationInfo(names, JMSServerControl.class.getName(), "Notifications emitted by a JMS Server")};
}
// Constructors --------------------------------------------------
- public JMSServerControlImpl(final JMSServerManager server) throws Exception
- {
+ public JMSServerControlImpl(final JMSServerManager server) throws Exception {
super(JMSServerControl.class, server.getActiveMQServer().getStorageManager());
this.server = server;
broadcaster = new NotificationBroadcasterSupport();
@@ -166,44 +148,29 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
boolean useDiscovery,
int cfType,
String[] connectorNames,
- Object[] bindings) throws Exception
- {
+ Object[] bindings) throws Exception {
checkStarted();
clearIO();
- try
- {
- if (useDiscovery)
- {
- if (connectorNames == null || connectorNames.length == 0)
- {
+ try {
+ if (useDiscovery) {
+ if (connectorNames == null || connectorNames.length == 0) {
throw new IllegalArgumentException("no discovery group name supplied");
}
- server.createConnectionFactory(name,
- ha,
- JMSFactoryType.valueOf(cfType),
- connectorNames[0],
- JMSServerControlImpl.convert(bindings));
+ server.createConnectionFactory(name, ha, JMSFactoryType.valueOf(cfType), connectorNames[0], JMSServerControlImpl.convert(bindings));
}
- else
- {
+ else {
List<String> connectorList = new ArrayList<String>(connectorNames.length);
- for (String str : connectorNames)
- {
+ for (String str : connectorNames) {
connectorList.add(str);
}
- server.createConnectionFactory(name,
- ha,
- JMSFactoryType.valueOf(cfType),
- connectorList,
- JMSServerControlImpl.convert(bindings));
+ server.createConnectionFactory(name, ha, JMSFactoryType.valueOf(cfType), connectorList, JMSServerControlImpl.convert(bindings));
}
}
- finally
- {
+ finally {
blockOnIO();
}
}
@@ -243,43 +210,8 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
long maxRetryInterval,
int reconnectAttempts,
boolean failoverOnInitialConnection,
- String groupId) throws Exception
- {
- createConnectionFactory(name,
- ha,
- useDiscovery,
- cfType,
- toArray(connectors),
- toArray(bindings),
- clientID,
- clientFailureCheckPeriod,
- connectionTTL,
- callTimeout,
- callFailoverTimeout,
- minLargeMessageSize,
- compressLargeMessages,
- consumerWindowSize,
- consumerMaxRate,
- confirmationWindowSize,
- producerWindowSize,
- producerMaxRate,
- blockOnAcknowledge,
- blockOnDurableSend,
- blockOnNonDurableSend,
- autoGroup,
- preAcknowledge,
- loadBalancingPolicyClassName,
- transactionBatchSize,
- dupsOKBatchSize,
- useGlobalPools,
- scheduledThreadPoolMaxSize,
- threadPoolMaxSize,
- retryInterval,
- retryIntervalMultiplier,
- maxRetryInterval,
- reconnectAttempts,
- failoverOnInitialConnection,
- groupId);
+ String groupId) throws Exception {
+ createConnectionFactory(name, ha, useDiscovery, cfType, toArray(connectors), toArray(bindings), clientID, clientFailureCheckPeriod, connectionTTL, callTimeout, callFailoverTimeout, minLargeMessageSize, compressLargeMessages, consumerWindowSize, consumerMaxRate, confirmationWindowSize, producerWindowSize, producerMaxRate, blockOnAcknowledge, blockOnDurableSend, blockOnNonDurableSend, autoGroup, preAcknowledge, loadBalancingPolicyClassName, transactionBatchSize, dupsOKBatchSize, useGlobalPools, scheduledThreadPoolMaxSize, threadPoolMaxSize, retryInterval, retryIntervalMultiplier, maxRetryInterval, reconnectAttempts, failoverOnInitialConnection, groupId);
}
@Override
@@ -317,71 +249,32 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
long maxRetryInterval,
int reconnectAttempts,
boolean failoverOnInitialConnection,
- String groupId) throws Exception
- {
+ String groupId) throws Exception {
checkStarted();
clearIO();
- try
- {
- ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl()
- .setName(name)
- .setHA(ha)
- .setBindings(bindings)
- .setFactoryType(JMSFactoryType.valueOf(cfType))
- .setClientID(clientID)
- .setClientFailureCheckPeriod(clientFailureCheckPeriod)
- .setConnectionTTL(connectionTTL)
- .setCallTimeout(callTimeout)
- .setCallFailoverTimeout(callFailoverTimeout)
- .setMinLargeMessageSize(minLargeMessageSize)
- .setCompressLargeMessages(compressLargeMessages)
- .setConsumerWindowSize(consumerWindowSize)
- .setConsumerMaxRate(consumerMaxRate)
- .setConfirmationWindowSize(confirmationWindowSize)
- .setProducerWindowSize(producerWindowSize)
- .setProducerMaxRate(producerMaxRate)
- .setBlockOnAcknowledge(blockOnAcknowledge)
- .setBlockOnDurableSend(blockOnDurableSend)
- .setBlockOnNonDurableSend(blockOnNonDurableSend)
- .setAutoGroup(autoGroup)
- .setPreAcknowledge(preAcknowledge)
- .setTransactionBatchSize(transactionBatchSize)
- .setDupsOKBatchSize(dupsOKBatchSize)
- .setUseGlobalPools(useGlobalPools)
- .setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize)
- .setThreadPoolMaxSize(threadPoolMaxSize)
- .setRetryInterval(retryInterval)
- .setRetryIntervalMultiplier(retryIntervalMultiplier)
- .setMaxRetryInterval(maxRetryInterval)
- .setReconnectAttempts(reconnectAttempts)
- .setFailoverOnInitialConnection(failoverOnInitialConnection)
- .setGroupID(groupId);
-
- if (useDiscovery)
- {
+ try {
+ ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl().setName(name).setHA(ha).setBindings(bindings).setFactoryType(JMSFactoryType.valueOf(cfType)).setClientID(clientID).setClientFailureCheckPeriod(clientFailureCheckPeriod).setConnectionTTL(connectionTTL).setCallTimeout(callTimeout).setCallFailoverTimeout(callFailoverTimeout).setMinLargeMessageSize(minLargeMessageSize).setCompressLargeMessages(compressLargeMessages).setConsumerWindowSize(consumerWindowSize).setConsumerMaxRate(consumerMaxRate).setConfirmationWindowSize(confirmationWindowSize).setProducerWindowSize(producerWindowSize).setProducerMaxRate(producerMaxRate).setBlockOnAcknowledge(blockOnAcknowledge).setBlockOnDurableSend(blockOnDurableSend).setBlockOnNonDurableSend(blockOnNonDurableSend).setAutoGroup(autoGroup).setPreAcknowledge(preAcknowledge).setTransactionBatchSize(transactionBatchSize).setDupsOKBatchSize(dupsOKBatchSize).setUseGlobalPools(useGlobalPools).setScheduledThreadPoolM
axSize(scheduledThreadPoolMaxSize).setThreadPoolMaxSize(threadPoolMaxSize).setRetryInterval(retryInterval).setRetryIntervalMultiplier(retryIntervalMultiplier).setMaxRetryInterval(maxRetryInterval).setReconnectAttempts(reconnectAttempts).setFailoverOnInitialConnection(failoverOnInitialConnection).setGroupID(groupId);
+
+ if (useDiscovery) {
configuration.setDiscoveryGroupName(connectorNames[0]);
}
- else
- {
+ else {
ArrayList<String> connectorNamesList = new ArrayList<String>();
- for (String nameC : connectorNames)
- {
+ for (String nameC : connectorNames) {
connectorNamesList.add(nameC);
}
configuration.setConnectorNames(connectorNamesList);
}
- if (loadBalancingPolicyClassName != null && !loadBalancingPolicyClassName.trim().equals(""))
- {
+ if (loadBalancingPolicyClassName != null && !loadBalancingPolicyClassName.trim().equals("")) {
configuration.setLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
}
server.createConnectionFactory(true, configuration, bindings);
}
- finally
- {
+ finally {
blockOnIO();
}
}
@@ -396,206 +289,166 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
boolean useDiscovery,
int cfType,
String connectors,
- String bindings) throws Exception
- {
+ String bindings) throws Exception {
createConnectionFactory(name, ha, useDiscovery, cfType, toArray(connectors), toArray(bindings));
}
- public boolean createQueue(final String name) throws Exception
- {
+ public boolean createQueue(final String name) throws Exception {
return createQueue(name, null, null, true);
}
- public boolean createQueue(final String name, final String bindings) throws Exception
- {
+ public boolean createQueue(final String name, final String bindings) throws Exception {
return createQueue(name, bindings, null, true);
}
@Override
- public boolean createQueue(String name, String bindings, String selector) throws Exception
- {
+ public boolean createQueue(String name, String bindings, String selector) throws Exception {
return createQueue(name, bindings, selector, true);
}
public boolean createQueue(@Parameter(name = "name", desc = "Name of the queue to create") String name,
@Parameter(name = "bindings", desc = "comma-separated list of Registry bindings (use ',' if u need to use commas in your bindings name)") String bindings,
@Parameter(name = "selector", desc = "the jms selector") String selector,
- @Parameter(name = "durable", desc = "is the queue persistent and resilient to restart") boolean durable) throws Exception
- {
+ @Parameter(name = "durable", desc = "is the queue persistent and resilient to restart") boolean durable) throws Exception {
checkStarted();
clearIO();
- try
- {
- return server.createQueue(true, name, selector, durable,
- JMSServerControlImpl.toArray(bindings));
+ try {
+ return server.createQueue(true, name, selector, durable, JMSServerControlImpl.toArray(bindings));
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public boolean destroyQueue(final String name) throws Exception
- {
+ public boolean destroyQueue(final String name) throws Exception {
return destroyQueue(name, false);
}
- public boolean destroyQueue(final String name, final boolean removeConsumers) throws Exception
- {
+ public boolean destroyQueue(final String name, final boolean removeConsumers) throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
return server.destroyQueue(name, removeConsumers);
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public boolean createTopic(String name) throws Exception
- {
+ public boolean createTopic(String name) throws Exception {
return createTopic(name, null);
}
- public boolean createTopic(final String topicName, final String bindings) throws Exception
- {
+ public boolean createTopic(final String topicName, final String bindings) throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
return server.createTopic(true, topicName, JMSServerControlImpl.toArray(bindings));
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public boolean destroyTopic(final String name) throws Exception
- {
+ public boolean destroyTopic(final String name) throws Exception {
return destroyTopic(name, true);
}
-
- public boolean destroyTopic(final String name, final boolean removeConsumers) throws Exception
- {
+ public boolean destroyTopic(final String name, final boolean removeConsumers) throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
return server.destroyTopic(name, removeConsumers);
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public void destroyConnectionFactory(final String name) throws Exception
- {
+ public void destroyConnectionFactory(final String name) throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
server.destroyConnectionFactory(name);
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public boolean isStarted()
- {
+ public boolean isStarted() {
return server.isStarted();
}
- public String getVersion()
- {
+ public String getVersion() {
checkStarted();
return server.getVersion();
}
- public String[] getQueueNames()
- {
+ public String[] getQueueNames() {
checkStarted();
clearIO();
- try
- {
+ try {
Object[] queueControls = server.getActiveMQServer().getManagementService().getResources(JMSQueueControl.class);
String[] names = new String[queueControls.length];
- for (int i = 0; i < queueControls.length; i++)
- {
+ for (int i = 0; i < queueControls.length; i++) {
JMSQueueControl queueControl = (JMSQueueControl) queueControls[i];
names[i] = queueControl.getName();
}
return names;
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public String[] getTopicNames()
- {
+ public String[] getTopicNames() {
checkStarted();
clearIO();
- try
- {
+ try {
Object[] topicControls = server.getActiveMQServer().getManagementService().getResources(TopicControl.class);
String[] names = new String[topicControls.length];
- for (int i = 0; i < topicControls.length; i++)
- {
+ for (int i = 0; i < topicControls.length; i++) {
TopicControl topicControl = (TopicControl) topicControls[i];
names[i] = topicControl.getName();
}
return names;
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public String[] getConnectionFactoryNames()
- {
+ public String[] getConnectionFactoryNames() {
checkStarted();
clearIO();
- try
- {
- Object[] cfControls = server.getActiveMQServer()
- .getManagementService()
- .getResources(ConnectionFactoryControl.class);
+ try {
+ Object[] cfControls = server.getActiveMQServer().getManagementService().getResources(ConnectionFactoryControl.class);
String[] names = new String[cfControls.length];
- for (int i = 0; i < cfControls.length; i++)
- {
+ for (int i = 0; i < cfControls.length; i++) {
ConnectionFactoryControl cfControl = (ConnectionFactoryControl) cfControls[i];
names[i] = cfControl.getName();
}
return names;
}
- finally
- {
+ finally {
blockOnIO();
}
}
@@ -604,132 +457,108 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
public void removeNotificationListener(final NotificationListener listener,
final NotificationFilter filter,
- final Object handback) throws ListenerNotFoundException
- {
+ final Object handback) throws ListenerNotFoundException {
broadcaster.removeNotificationListener(listener, filter, handback);
}
- public void removeNotificationListener(final NotificationListener listener) throws ListenerNotFoundException
- {
+ public void removeNotificationListener(final NotificationListener listener) throws ListenerNotFoundException {
broadcaster.removeNotificationListener(listener);
}
public void addNotificationListener(final NotificationListener listener,
final NotificationFilter filter,
- final Object handback) throws IllegalArgumentException
- {
+ final Object handback) throws IllegalArgumentException {
broadcaster.addNotificationListener(listener, filter, handback);
}
- public MBeanNotificationInfo[] getNotificationInfo()
- {
+ public MBeanNotificationInfo[] getNotificationInfo() {
return JMSServerControlImpl.getNotificationInfos();
}
- public String[] listRemoteAddresses() throws Exception
- {
+ public String[] listRemoteAddresses() throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
return server.listRemoteAddresses();
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public String[] listRemoteAddresses(final String ipAddress) throws Exception
- {
+ public String[] listRemoteAddresses(final String ipAddress) throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
return server.listRemoteAddresses(ipAddress);
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public boolean closeConnectionsForAddress(final String ipAddress) throws Exception
- {
+ public boolean closeConnectionsForAddress(final String ipAddress) throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
return server.closeConnectionsForAddress(ipAddress);
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public boolean closeConsumerConnectionsForAddress(final String address) throws Exception
- {
+ public boolean closeConsumerConnectionsForAddress(final String address) throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
return server.closeConsumerConnectionsForAddress(address);
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public boolean closeConnectionsForUser(final String userName) throws Exception
- {
+ public boolean closeConnectionsForUser(final String userName) throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
return server.closeConnectionsForUser(userName);
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public String[] listConnectionIDs() throws Exception
- {
+ public String[] listConnectionIDs() throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
return server.listConnectionIDs();
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public String listConnectionsAsJSON() throws Exception
- {
+ public String listConnectionsAsJSON() throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
JSONArray array = new JSONArray();
Set<RemotingConnection> connections = server.getActiveMQServer().getRemotingService().getConnections();
@@ -739,19 +568,15 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
Map<Object, ServerSession> jmsSessions = new HashMap<Object, ServerSession>();
// First separate the real jms sessions, after all we are only interested in those here on the *jms* server controller
- for (ServerSession session : sessions)
- {
- if (session.getMetaData(ClientSession.JMS_SESSION_IDENTIFIER_PROPERTY) != null)
- {
+ for (ServerSession session : sessions) {
+ if (session.getMetaData(ClientSession.JMS_SESSION_IDENTIFIER_PROPERTY) != null) {
jmsSessions.put(session.getConnectionID(), session);
}
}
- for (RemotingConnection connection : connections)
- {
+ for (RemotingConnection connection : connections) {
ServerSession session = jmsSessions.get(connection.getID());
- if (session != null)
- {
+ if (session != null) {
JSONObject obj = new JSONObject();
obj.put("connectionID", connection.getID().toString());
obj.put("clientAddress", connection.getRemoteAddress());
@@ -764,36 +589,28 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
}
return array.toString();
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public String listConsumersAsJSON(String connectionID) throws Exception
- {
+ public String listConsumersAsJSON(String connectionID) throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
JSONArray array = new JSONArray();
Set<RemotingConnection> connections = server.getActiveMQServer().getRemotingService().getConnections();
- for (RemotingConnection connection : connections)
- {
- if (connectionID.equals(connection.getID().toString()))
- {
+ for (RemotingConnection connection : connections) {
+ if (connectionID.equals(connection.getID().toString())) {
List<ServerSession> sessions = server.getActiveMQServer().getSessions(connectionID);
- for (ServerSession session : sessions)
- {
+ for (ServerSession session : sessions) {
Set<ServerConsumer> consumers = session.getServerConsumers();
- for (ServerConsumer consumer : consumers)
- {
+ for (ServerConsumer consumer : consumers) {
JSONObject obj = toJSONObject(consumer);
- if (obj != null)
- {
+ if (obj != null) {
array.put(obj);
}
}
@@ -802,87 +619,71 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
}
return array.toString();
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public String listAllConsumersAsJSON() throws Exception
- {
+ public String listAllConsumersAsJSON() throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
JSONArray array = new JSONArray();
Set<ServerSession> sessions = server.getActiveMQServer().getSessions();
- for (ServerSession session : sessions)
- {
+ for (ServerSession session : sessions) {
Set<ServerConsumer> consumers = session.getServerConsumers();
- for (ServerConsumer consumer : consumers)
- {
+ for (ServerConsumer consumer : consumers) {
JSONObject obj = toJSONObject(consumer);
- if (obj != null)
- {
+ if (obj != null) {
array.put(obj);
}
}
}
return array.toString();
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public String[] listSessions(final String connectionID) throws Exception
- {
+ public String[] listSessions(final String connectionID) throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
return server.listSessions(connectionID);
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public String listPreparedTransactionDetailsAsJSON() throws Exception
- {
+ public String listPreparedTransactionDetailsAsJSON() throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
return server.listPreparedTransactionDetailsAsJSON();
}
- finally
- {
+ finally {
blockOnIO();
}
}
- public String listPreparedTransactionDetailsAsHTML() throws Exception
- {
+ public String listPreparedTransactionDetailsAsHTML() throws Exception {
checkStarted();
clearIO();
- try
- {
+ try {
return server.listPreparedTransactionDetailsAsHTML();
}
- finally
- {
+ finally {
blockOnIO();
}
}
@@ -894,106 +695,88 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
* @see org.apache.activemq.artemis.core.management.impl.AbstractControl#fillMBeanOperationInfo()
*/
@Override
- protected MBeanOperationInfo[] fillMBeanOperationInfo()
- {
+ protected MBeanOperationInfo[] fillMBeanOperationInfo() {
return MBeanInfoHelper.getMBeanOperationsInfo(JMSServerControl.class);
}
// Private -------------------------------------------------------
- private void checkStarted()
- {
- if (!server.isStarted())
- {
+ private void checkStarted() {
+ if (!server.isStarted()) {
throw new IllegalStateException("ActiveMQ Artemis JMS Server is not started. It can not be managed yet");
}
}
// Inner classes -------------------------------------------------
- public String[] listTargetDestinations(String sessionID) throws Exception
- {
+ public String[] listTargetDestinations(String sessionID) throws Exception {
String[] addresses = server.getActiveMQServer().getActiveMQServerControl().listTargetAddresses(sessionID);
Map<String, DestinationControl> allDests = new HashMap<String, DestinationControl>();
Object[] queueControls = server.getActiveMQServer().getManagementService().getResources(JMSQueueControl.class);
- for (Object queueControl2 : queueControls)
- {
+ for (Object queueControl2 : queueControls) {
JMSQueueControl queueControl = (JMSQueueControl) queueControl2;
allDests.put(queueControl.getAddress(), queueControl);
}
Object[] topicControls = server.getActiveMQServer().getManagementService().getResources(TopicControl.class);
- for (Object topicControl2 : topicControls)
- {
+ for (Object topicControl2 : topicControls) {
TopicControl topicControl = (TopicControl) topicControl2;
allDests.put(topicControl.getAddress(), topicControl);
}
List<String> destinations = new ArrayList<String>();
- for (String addresse : addresses)
- {
+ for (String addresse : addresses) {
DestinationControl control = allDests.get(addresse);
- if (control != null)
- {
+ if (control != null) {
destinations.add(control.getAddress());
}
}
return destinations.toArray(new String[0]);
}
- public String getLastSentMessageID(String sessionID, String address) throws Exception
- {
+ public String getLastSentMessageID(String sessionID, String address) throws Exception {
ServerSession session = server.getActiveMQServer().getSessionByID(sessionID);
- if (session != null)
- {
+ if (session != null) {
return session.getLastSentMessageID(address);
}
return null;
}
- public String getSessionCreationTime(String sessionID) throws Exception
- {
+ public String getSessionCreationTime(String sessionID) throws Exception {
ServerSession session = server.getActiveMQServer().getSessionByID(sessionID);
- if (session != null)
- {
+ if (session != null) {
return String.valueOf(session.getCreationTime());
}
return null;
}
- public String listSessionsAsJSON(final String connectionID) throws Exception
- {
+ public String listSessionsAsJSON(final String connectionID) throws Exception {
checkStarted();
clearIO();
JSONArray array = new JSONArray();
- try
- {
+ try {
List<ServerSession> sessions = server.getActiveMQServer().getSessions(connectionID);
- for (ServerSession sess : sessions)
- {
+ for (ServerSession sess : sessions) {
JSONObject obj = new JSONObject();
obj.put("sessionID", sess.getName());
obj.put("creationTime", sess.getCreationTime());
array.put(obj);
}
}
- finally
- {
+ finally {
blockOnIO();
}
return array.toString();
}
- public String closeConnectionWithClientID(final String clientID) throws Exception
- {
+ public String closeConnectionWithClientID(final String clientID) throws Exception {
return server.getActiveMQServer().destroyConnectionWithSessionMetadata(ClientSession.JMS_SESSION_CLIENT_ID_PROPERTY, clientID);
}
- private JSONObject toJSONObject(ServerConsumer consumer) throws Exception
- {
+ private JSONObject toJSONObject(ServerConsumer consumer) throws Exception {
JSONObject obj = new JSONObject();
obj.put("consumerID", consumer.getID());
obj.put("connectionID", consumer.getConnectionID());
@@ -1003,37 +786,28 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
obj.put("creationTime", consumer.getCreationTime());
// JMS consumer with message filter use the queue's filter
Filter queueFilter = consumer.getQueue().getFilter();
- if (queueFilter != null)
- {
+ if (queueFilter != null) {
obj.put("filter", queueFilter.getFilterString().toString());
}
String[] destinationInfo = determineJMSDestination(consumer.getQueue().getAddress().toString());
- if (destinationInfo == null)
- {
+ if (destinationInfo == null) {
return null;
}
obj.put("destinationName", destinationInfo[0]);
obj.put("destinationType", destinationInfo[1]);
- if (destinationInfo[1].equals("topic"))
- {
- try
- {
- ActiveMQDestination.decomposeQueueNameForDurableSubscription(consumer.getQueue()
- .getName()
- .toString());
+ if (destinationInfo[1].equals("topic")) {
+ try {
+ ActiveMQDestination.decomposeQueueNameForDurableSubscription(consumer.getQueue().getName().toString());
obj.put("durable", true);
}
- catch (IllegalArgumentException e)
- {
+ catch (IllegalArgumentException e) {
obj.put("durable", false);
}
- catch (JMSRuntimeException e)
- {
+ catch (JMSRuntimeException e) {
obj.put("durable", false);
}
}
- else
- {
+ else {
obj.put("durable", false);
}
@@ -1041,14 +815,13 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
}
@Override
- public void onNotification(org.apache.activemq.artemis.core.server.management.Notification notification)
- {
- if (!(notification.getType() instanceof JMSNotificationType)) return;
+ public void onNotification(org.apache.activemq.artemis.core.server.management.Notification notification) {
+ if (!(notification.getType() instanceof JMSNotificationType))
+ return;
JMSNotificationType type = (JMSNotificationType) notification.getType();
TypedProperties prop = notification.getProperties();
- this.broadcaster.sendNotification(new Notification(type.toString(), this,
- notifSeq.incrementAndGet(), prop.getSimpleStringProperty(JMSNotificationType.MESSAGE).toString()));
+ this.broadcaster.sendNotification(new Notification(type.toString(), this, notifSeq.incrementAndGet(), prop.getSimpleStringProperty(JMSNotificationType.MESSAGE).toString()));
}
}