| | |
| | | mUdpClientPool = new ConcurrentHashMap<>();
|
| | | }
|
| | |
|
| | |
|
| | | private static class SingletonInstance {
|
| | | private static final SocketPool INSTANCE = new SocketPool();
|
| | | }
|
| | | private static final SocketPool instance = new SocketPool();
|
| | |
|
| | | public static SocketPool getInstance() {
|
| | | return SingletonInstance.INSTANCE;
|
| | | return instance;
|
| | | }
|
| | |
|
| | | public void clear() {
|
| | |
| | | mUdpClientPool.clear();
|
| | | }
|
| | |
|
| | | public synchronized DatagramSocket getUdpSocket1(InetSocketAddress address) throws SocketException {
|
| | | public synchronized DatagramSocket getUdpSocket(InetSocketAddress address) throws SocketException {
|
| | | DatagramSocket socket;
|
| | | final String key = address.toString();
|
| | | if (mUdpClientPool.containsKey(key)) {
|