In the book Java concurrency in practice, when talking about ways to publish an object, there is a mechanism is to publish an inner class instance, and it is not safe because
inner class instances contain a hidden reference to the enclosing instance
I was wondering how come it is unsafe if you couldn't get the outer class instance through an inner class instance, just because it will effect the GC? I'm confused, whether there is a way to get an outer class instance ,like reflection?
Aucun commentaire:
Enregistrer un commentaire