Right now I'm reading this article regarding Java Garbage Collection: http://www.javaworld.com/javaworld/jw-08-1996/jw-08-gc.html?
Here is a snippet of a function in a JMS client
public void foo(){
...//Create Connection factory, connection, and session, topic
TopicSubscriber tp = session.createDurableSubcriber(topic,"001");
tp.setMessageListener(this)
}
This question isn't about JMS but more what happens with the object "tp" after foo() function call has ended. After the function ends there is no way to reference tp anymore. I'm assuming in createDurableSubscriber() that it's using the keyword "new" which means that the object is being placed on the JVM heap. However since tp can no longer be referenced is it subject to the JVM garbage collection?