mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-11 03:09:46 +02:00
Remove smack.util.Cache
and use the Cache from jxmpp-util-cache instead.
This commit is contained in:
parent
9016120d71
commit
f2718c2d76
4 changed files with 9 additions and 753 deletions
|
@ -27,10 +27,11 @@ import org.jivesoftware.smack.XMPPException;
|
|||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.util.Cache;
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
|
||||
import org.jxmpp.util.cache.Cache;
|
||||
import org.jxmpp.util.cache.ExpirationCache;
|
||||
|
||||
/**
|
||||
* Socks5BytestreamRequest class handles incoming SOCKS5 Bytestream requests.
|
||||
|
@ -46,7 +47,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
private static final int BLACKLIST_MAX_SIZE = 100;
|
||||
|
||||
/* blacklist of addresses of SOCKS5 proxies */
|
||||
private static final Cache<String, Integer> ADDRESS_BLACKLIST = new Cache<String, Integer>(
|
||||
private static final Cache<String, Integer> ADDRESS_BLACKLIST = new ExpirationCache<String, Integer>(
|
||||
BLACKLIST_MAX_SIZE, BLACKLIST_LIFETIME);
|
||||
|
||||
/*
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.jivesoftware.smack.filter.PacketFilter;
|
|||
import org.jivesoftware.smack.filter.AndFilter;
|
||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||
import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
||||
import org.jivesoftware.smack.util.Cache;
|
||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||
import org.jivesoftware.smackx.caps.cache.EntityCapsPersistentCache;
|
||||
import org.jivesoftware.smackx.caps.packet.CapsExtension;
|
||||
|
@ -47,6 +46,7 @@ import org.jivesoftware.smackx.disco.packet.DiscoverInfo.Identity;
|
|||
import org.jivesoftware.smackx.disco.packet.DiscoverItems.Item;
|
||||
import org.jivesoftware.smackx.xdata.FormField;
|
||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||
import org.jxmpp.util.cache.LruCache;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
@ -96,7 +96,7 @@ public class EntityCapsManager extends Manager {
|
|||
/**
|
||||
* Map of (node + '#" + hash algorithm) to DiscoverInfo data
|
||||
*/
|
||||
private static final Cache<String, DiscoverInfo> CAPS_CACHE = new Cache<String, DiscoverInfo>(1000, -1);
|
||||
private static final LruCache<String, DiscoverInfo> CAPS_CACHE = new LruCache<String, DiscoverInfo>(1000);
|
||||
|
||||
/**
|
||||
* Map of Full JID -> DiscoverInfo/null. In case of c2s connection the
|
||||
|
@ -104,7 +104,7 @@ public class EntityCapsManager extends Manager {
|
|||
* link-local connection the key is formed as user@host (no resource) In
|
||||
* case of a server or component the key is formed as domain
|
||||
*/
|
||||
private static final Cache<String, NodeVerHash> JID_TO_NODEVER_CACHE = new Cache<String, NodeVerHash>(10000, -1);
|
||||
private static final LruCache<String, NodeVerHash> JID_TO_NODEVER_CACHE = new LruCache<String, NodeVerHash>(10000);
|
||||
|
||||
static {
|
||||
XMPPConnectionRegistry.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
|
|
|
@ -32,12 +32,13 @@ import org.jivesoftware.smack.packet.IQ;
|
|||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.util.Cache;
|
||||
import org.jivesoftware.smackx.caps.EntityCapsManager;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo.Identity;
|
||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||
import org.jxmpp.util.cache.Cache;
|
||||
import org.jxmpp.util.cache.ExpirationCache;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -682,7 +683,7 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* Create a cache to hold the 25 most recently lookup services for a given feature for a period
|
||||
* of 24 hours.
|
||||
*/
|
||||
private Cache<String, List<String>> services = new Cache<String, List<String>>(25,
|
||||
private Cache<String, List<String>> services = new ExpirationCache<String, List<String>>(25,
|
||||
24 * 60 * 60 * 1000);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue