}
private boolean isEndpointRegistered(String applicationName, EndpointClassNamePathPair endpoint) {
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
String fullMxBeanName = "org.glassfish.tyrus:type=" + applicationName;
ApplicationMXBean proxy;
try {
proxy = JMX.newMXBeanProxy(mBeanServer, new ObjectName(fullMxBeanName), ApplicationMXBean.class);
List<EndpointClassNamePathPair> registeredEndpoints = proxy.getEndpoints();
for (EndpointClassNamePathPair registeredEndpoint : registeredEndpoints) {
if (registeredEndpoint.getEndpointPath().equals(endpoint.getEndpointPath()) && registeredEndpoint.getEndpointClassName().equals(endpoint.getEndpointClassName())) {
return true;
}
}