Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.activemq.broker.jmx;

import java.net.URISyntaxException;

import org.apache.activemq.network.NetworkConnector;

public class NetworkConnectorView implements NetworkConnectorViewMBean {
Expand All @@ -37,6 +39,20 @@ public void stop() throws Exception {
connector.stop();
}

@Override
public String getUri() {
return connector.getUri() != null ? connector.getUri().toString() : "";
}

@Override
public String getLocalUri() {
try {
return connector.getLocalUri() != null ? connector.getLocalUri().toString() : "";
} catch (URISyntaxException e) {
return "";
}
}

@Override
public String getName() {
return connector.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

public interface NetworkConnectorViewMBean extends Service {

String getUri();

String getLocalUri();

String getName();

int getMessageTTL();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public void setRemoteTransport(Transport remoteTransport) {
this.remoteTransport = remoteTransport;
}

@Override
public URI getUri() {
return remoteURI;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's redundant with getRemoteURI() here, but it's for consistency.

I'm fine to use getRemoveURI() everywhere if it makes more sense.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit weird indeed. Maybe add a small comment for us, so no one goes in one month from now and says, it's duplicate I'll remove it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd make more sense to make MulticastNetworkConnector have a 'getUri()' method instead.

I'm pretty against doing any field name mapping at the admin view b/c it is miscommunicating to users

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I was hesitating. Thanks for your inputs, let's use getRemoteURI() then.

}

public URI getRemoteURI() {
return remoteURI;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public NetworkConnector(URI localURI) {
this.localURI = localURI;
}

public abstract URI getUri();

public URI getLocalUri() throws URISyntaxException {
return localURI;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,7 @@ public void testBridgeRegistration() throws Exception {

assertNotNull(nc);
assertEquals("NC", nc.getName());
assertEquals("static:(tcp://localhost:61617)", nc.getUri());
assertNotNull(nc.getLocalUri());
}
}
Loading