Skip to content

Commit

Permalink
Various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-sexenian committed Oct 24, 2023
1 parent cbf0408 commit 1ed48e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.security.cert.CertificateException;
import java.util.*;
import com.genexus.ModelContext;
import com.genexus.management.HTTPConnectionJMX;
import com.genexus.management.HTTPPoolJMX;
import com.genexus.management.MBeanUtils;
import com.genexus.util.IniFile;
Expand Down Expand Up @@ -91,13 +92,13 @@ private static void getPoolInstance() {
@Override
public void onConnectionCreated(HttpRoute route) {
if (Application.isJMXEnabled())
MBeanUtils.createMBean(route);
HTTPConnectionJMX.CreateHTTPConnectionJMX(route);
}

@Override
public void onConnectionDestroyed(HttpRoute route) {
if (Application.isJMXEnabled())
MBeanUtils.destroyMBean(route);
HTTPConnectionJMX.DestroyHTTPConnectionJMX(route);
}

private ConnectionKeepAliveStrategy generateKeepAliveStrategy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class HTTPConnectionJMX implements HTTPConnectionJMXBean{

private static Logger log = org.apache.logging.log4j.LogManager.getLogger(HTTPPoolJMX.class);
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(HTTPConnectionJMX.class);

HttpRoute connection;

Expand Down
6 changes: 3 additions & 3 deletions java/src/main/java/com/genexus/management/MBeanUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static void createMBean(HttpRoute httpRoute)
if (mbs == null)
return;
HTTPConnectionJMX mbean = new HTTPConnectionJMX(httpRoute);
registerBean(mbean, "com.genexus.management:type=GeneXusApplicationServer.ApplicationName.HTTPPool.HTTPConnection,ApplicationName=" + httpRoute.hashCode() + ",HttpConnection=" + httpRoute.toString() + ",name=Http Connection");
registerBean(mbean, "com.genexus.management:type=GeneXusApplicationServer.ApplicationName.HTTPPool.HTTPConnection,ApplicationName=" + httpRoute.getTargetHost().getHostName() + ",Port=" + httpRoute.getTargetHost().getPort()+ ",name=http connection");
}

public static void createMBean(GXConnection connection)
Expand Down Expand Up @@ -263,15 +263,15 @@ public static void destroyMBean(GXConnection connection)
}
}

public static void destroyMBean(HttpRoute httpConnection)
public static void destroyMBean(HttpRoute httpRoute)
{
MBeanServer mbs = getMBeanServer();
if (mbs == null)
return;

try
{
ObjectName name = new ObjectName("com.genexus.management:type=GeneXusApplicationServer.ApplicationName.HTTPPool.HTTPConnection,ApplicationName=" + httpConnection.hashCode() + ",HttpConnection=" + httpConnection.toString() + ",name=Http Connection");
ObjectName name = new ObjectName("com.genexus.management:type=GeneXusApplicationServer.ApplicationName.HTTPPool.HTTPConnection,ApplicationName=" + httpRoute.getTargetHost().getHostName() + ",Port=" + httpRoute.getTargetHost().getPort() + ",name=http connection");
registeredObjects.removeElement(name);

mbs.unregisterMBean(name);
Expand Down

0 comments on commit 1ed48e9

Please sign in to comment.