• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Tomcat Connectors JK 1.2 destroy method not getting called for ajp13

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using “Tomcat Connectors JK 1.2” for Windows. When build and integrated the code, the “destroy” method is not getting called, which is
Potentially causing memory leak. We are instantiating ajp13 worker threads.

Have anyone faced the same issue???
 
Saloon Keeper
Posts: 28663
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, sanyukta!

Unless you are seeing an actual memory leak, I would not worry about that. There are others here whou could tell you more about destroy(), but as I recall, it doesn't get invoked until the garbage collector actually starts recovering abandoned resources and that can be a long time after you last de-referenced them.

Also, for all I know (I use Apache mod_proxy and haven't used any of the jk connectors in a long time), those connectors may be pooled. Meaning that they are never fully de-referenced, but simply returned to a pool for better performance. In which case the connector objects would never be eligable for garbage collection or for destruction.
 
sanyukta pandey
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim, can you help me with documentation where they have stated how to destroy objects in proper manner?
 
Tim Holloway
Saloon Keeper
Posts: 28663
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You cannot "destroy" objects in Java, only create them.

When a Java object is no longer referenced by anything, it becomes eligible for garbage collection. Garbage collection is an automatic process that can happen at unpredictable times. While it was possible to force garbage collection in early versions of Java, modern-day GC doesn't run the same way as it is more incremental, so while invoking the gc() method will probably free up some memory there is no guarantee that any specific object's destroy() method would get called.

In any event, a destroy() method should never be used as part of application logic because you neer know when - or if - it will be invoked. It is intended to release resources that normal garbage collection doesn't know how to release.

You certainly wouldn't want to go around doing stuff like that to objects like Tomcat connectors that you are only "loaned".
 
reply
    Bookmark Topic Watch Topic
  • New Topic