Skip to content

Commit

Permalink
Shutdown runnable when no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-sexenian committed Oct 26, 2023
1 parent a15eaa7 commit 2a396b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ private void notifyConnectionDestroyed(HttpRoute route) {
for (IConnectionObserver observer : observers)
observer.onConnectionDestroyed(route);
}

@Override
protected void finalize() throws Throwable {
super.finalize();
scheduler.shutdown();
}
}


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

public static void createMBean(GXConnection connection)
Expand Down Expand Up @@ -265,7 +265,7 @@ public static void destroyMBean(HttpRoute httpRoute) {
return;

try {
ObjectName name = new ObjectName("com.genexus.management:type=GeneXusApplicationServer.HTTPPool.HTTPConnection,ApplicationName=" + httpRoute.getTargetHost().getHostName() + ",Port=" + httpRoute.getTargetHost().getPort() + ",name=http connection");
ObjectName name = new ObjectName("com.genexus.management:type=GeneXusApplicationServer.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 2a396b9

Please sign in to comment.