This method takes care of any global clean-up that might be required. It automatically frees all allocated resources, including those for Contexts and Sessions that have been previously created but are not destroyed. Note that if Cleanup() is called while sessions are connected, any messages buffered for transmission are discarded and not sent. In most applications, it is not necessary to call ContextFactory.Cleanup() as the resources in use are automatically recovered when the application exits. ContextFactory.Cleanup() exists for rare applications that may want recover all API resources and continue operating without using the API further.
public void Cleanup()