In Java when I have an application running in appserver like glassfish, with my application deployed as EJB. When I undeploy EJB what happens to to sigletone classes that a loaded into memory. I understand until I restart the container they are present there and can be garbage collected but I am not sure where and when it will happen, So if I deploy the ejb once again it may pick up the old objects from jvm,
?
In Java when I have an application running in appserver like glassfish, with my
Share
Each deployed app is loaded with its own separate classloader. Since the classloader is part of a class’s identity, the same class can be loaded multiple times (with different configuration) without the different instances interfering with each other.
This effectively isolates different applications within an app server from each other and even allows the same application to be run twice in parallel.
When an application is undeployed, all its objects (including the classloader and thus the classes themselves) will be garbage collected, if no references to them remain. Unfortunately, it can happen that references remain in some system class and prevent the garbage collection – this is called a classloader leak.