JDK-6566891 : RMIConnector: map value referencing map key in WeakHashMap prevents map entry to be removed
  • Type: Bug
  • Status: Closed
  • Resolution: Fixed
  • Component: core-svc
  • Sub-Component: javax.management
  • Priority: P2
  • Affected Version: 7
  • OS: generic
  • CPU: generic
  • Submit Date: 2007-06-07
  • Updated Date: 2014-02-12
  • Resolved Date: 2013-08-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u60Fixed 8 b108Fixed
Description
The RMIConnector class defines a WeakHashMap that keeps an MBeanServerConnection
per delegation subject. The problem is that the MBeanServerConnection internally
holds a reference to the delegation subject, i.e. the WeakHashMap key, thus preventing
a given entry to be removed unless both the delegation subject and MBeanServerConnection
instances get nulled.

Comments
SUGGESTED FIX Put the MBeanServerConnection into a WeakReference before saving it into the map. Change: private transient WeakHashMap<Subject, MBeanServerConnection> rmbscMap; into: private transient WeakHashMap<Subject, WeakReference<MBeanServerConnection>> rmbscMap;
2007-06-07

EVALUATION The entries in the WeakHashMap are not removed when the delegation subject (the map key) gets nulled however all the map entries are removed when RMIConnector.close() is called.
2007-06-07