0

I came across a rather interesting thread on the Bukkit forums today. The poster was encountering a ClassNotFoundException upon attempting to create a new instance after hours of not using it. It works without issue when the JVM is first started. This all occurs within a single uninterrupted instance of the JVM. He suspects that Java is GCing his class, but I have no clue as to why that might happen (or how to fix it for that matter), so I've decided to ask here. What exactly is happening to the class, and how would the problem be fixed?

Edit: After a bit more investigation, I've found that as long as the plugin owning the class is still running, the class itself is ineligible for garbage collection.

Max Roncace
  • 1,277
  • 2
  • 15
  • 40
  • 1
    This may give you some clues: http://stackoverflow.com/questions/2433261/when-and-how-are-classes-garbage-collected-in-java – kosa Apr 17 '14 at 18:30
  • @Nambari After a bit more investigation, I've found that as long as the plugin owning the class is still running, the class itself is ineligible for garbage collection. – Max Roncace Apr 17 '14 at 18:42
  • Correct. I am guessing some how that plugin was active, which opened gate for GC. – kosa Apr 17 '14 at 18:43

0 Answers0