mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-02 06:45:59 +01:00
SMACK-439
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13649 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
37f6bf12da
commit
2195d66e4d
1 changed files with 6 additions and 0 deletions
|
@ -2573,9 +2573,15 @@ public class MultiUserChat {
|
|||
private static class InvitationsMonitor implements ConnectionListener {
|
||||
// We use a WeakHashMap so that the GC can collect the monitor when the
|
||||
// connection is no longer referenced by any object.
|
||||
// Note that when the InvitationsMonitor is used, i.e. when there are InvitationListeners, it will add a
|
||||
// PacketListener to the Connection and therefore a strong reference from the Connection to the
|
||||
// InvitationsMonior will exists, preventing it from beeing gc'ed. After the last InvitationListener is gone,
|
||||
// the PacketListener will get removed (cancel()) allowing the garbage collection of the InvitationsMonitor
|
||||
// instance.
|
||||
private final static Map<Connection, WeakReference<InvitationsMonitor>> monitors =
|
||||
new WeakHashMap<Connection, WeakReference<InvitationsMonitor>>();
|
||||
|
||||
// We don't use a synchronized List here because it would break the semantic of (add|remove)InvitationListener
|
||||
private final List<InvitationListener> invitationsListeners =
|
||||
new ArrayList<InvitationListener>();
|
||||
private Connection connection;
|
||||
|
|
Loading…
Reference in a new issue