@@ -169,18 +169,14 @@ public Collection<ConnectionViewMBean> getConnections() throws Exception {
169169
170170 @ Override
171171 @ SuppressWarnings ("unchecked" )
172- public Collection <String > getConnections (String connectorName ) throws Exception {
172+ public Collection <ConnectionViewMBean > getConnections (String connectorName ) throws Exception {
173173 String brokerName = getBrokerName ();
174174 connectorName = JMXSupport .encodeObjectNamePart (connectorName );
175175 ObjectName query = new ObjectName ("org.apache.activemq:type=Broker,brokerName=" + brokerName
176176 + ",connector=clientConnectors,connectorName=" + connectorName + ",connectionViewType=clientId,connectionName=*" );
177177 Set <ObjectName > queryResult = queryNames (query , null );
178- Collection < ConnectionViewMBean > connections = getManagedObjects (queryResult .toArray (new ObjectName [queryResult .size ()]),
178+ return getManagedObjects (queryResult .toArray (new ObjectName [queryResult .size ()]),
179179 ConnectionViewMBean .class );
180- Collection <String > result = new ArrayList <String >(queryResult .size ());
181- for (ConnectionViewMBean connection : connections )
182- result .add (connection .getClientId ());
183- return result ;
184180 }
185181
186182 @ Override
@@ -200,14 +196,13 @@ public ConnectionViewMBean getConnection(String connectionName) throws Exception
200196
201197 @ Override
202198 @ SuppressWarnings ("unchecked" )
203- public Collection <String > getConnectors () throws Exception {
199+ public Collection <ConnectorViewMBean > getConnectors () throws Exception {
204200 String brokerName = getBrokerName ();
205201 ObjectName query = new ObjectName ("org.apache.activemq:type=Broker,brokerName=" + brokerName + ",connector=clientConnectors,connectorName=*" );
206202 Set <ObjectName > queryResult = queryNames (query , null );
207203 Collection <String > result = new ArrayList <String >(queryResult .size ());
208- for (ObjectName on : queryResult )
209- result .add (on .getKeyProperty ("connectorName" ));
210- return result ;
204+ return getManagedObjects (queryResult .toArray (new ObjectName [queryResult .size ()]),
205+ ConnectorViewMBean .class );
211206 }
212207
213208 @ Override
0 commit comments