We are using a 3rd party library that allocates some resources in one of our topologies.
Is there a listener or something that gets notified when the topology starts / stops running in the Task Manager's JVM? The 3rd party library uses a singleton, so I need to initialize the singleton when the first task is started on the task manager and clear out the singleton when the last task is stopped in order to allow the topology classloader to be unloadable. I had thought it could all be done from the Topology's main method, but after much head-banging we were able to identify that *when run on a distributed cluster* the main method is not invoked to start the topology for each task manager.