1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 12:02:05 +01:00

Use weak map for 'managers' in Socks5BytestreamManager

Fixes memory leak and SMACK-678.
This commit is contained in:
Florian Schmaus 2015-06-29 17:07:42 +02:00
parent 7d97653926
commit a9741a8b10

View file

@ -20,11 +20,11 @@ import java.io.IOException;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeoutException;
@ -110,7 +110,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
private final static Random randomGenerator = new Random();
/* stores one Socks5BytestreamManager for each XMPP connection */
private final static Map<XMPPConnection, Socks5BytestreamManager> managers = new HashMap<XMPPConnection, Socks5BytestreamManager>();
private final static Map<XMPPConnection, Socks5BytestreamManager> managers = new WeakHashMap<>();
/*
* assigns a user to a listener that is informed if a bytestream request for this user is