本文整理汇总了Java中org.apache.commons.collections4.map.ReferenceMap类的典型用法代码示例。如果您正苦于以下问题:Java ReferenceMap类的具体用法?Java ReferenceMap怎么用?Java ReferenceMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReferenceMap类属于org.apache.commons.collections4.map包,在下文中一共展示了ReferenceMap类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractTransaction
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
AbstractTransaction(String id, StorageAccessIF access) {
this.id = id;
this.access = access;
this.mapping = access.getStorage().getMapping();
// Map containing named queries
this.querymap = new HashMap<String, QueryIF>();
// Identity map - maintains the relationships between object
// identities and the single(ton) instances used with the
// transaction. This enforces the constraint that only one
// instance per object identity should exist at a given time in a
// transaction.
// NOTE: Even though it's the keys that are garbage collected
// there is a strict mapping between IdentityIF and PersistentIF
// that lets us do this, i.e. the objects reference their
// identities, so the identity will not be garbage collected as
// long as the object is reachable.
this.identity_map = new ReferenceMap<IdentityIF, PersistentIF>(AbstractReferenceMap.ReferenceStrength.HARD, AbstractReferenceMap.ReferenceStrength.SOFT);
log.debug(getId() + ": Transaction created.");
this.timestamp = System.currentTimeMillis();
}
示例2: getCustomResourceClassLoader
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
public ResourceClassLoader getCustomResourceClassLoader(Resource[] resources) throws IOException{
if (ArrayUtil.isEmpty(resources))
return this;
String key = hash(resources);
ResourceClassLoader rcl = (customCLs == null) ? null : customCLs.get(key);
if (rcl != null)
return rcl;
resources = ResourceUtil.merge(this.getResources(), resources);
rcl = new ResourceClassLoader(resources, getParent());
if (customCLs == null)
customCLs = new ReferenceMap<String,ResourceClassLoader>();
customCLs.put(key, rcl);
return rcl;
}
示例3: ResourceManager
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private ResourceManager() {
// resources = new HashMap<String, IResource>();
resources = new ReferenceMap(AbstractReferenceMap.ReferenceStrength.SOFT,
AbstractReferenceMap.ReferenceStrength.SOFT, true);
random = new SecureRandom();
}
示例4: BasicRemotePeerRegistry
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
/**
* Constructs a new {@code BasicRemotePeerRegistry} instance.
*/
@SuppressWarnings("unchecked")
public BasicRemotePeerRegistry() {
backingStore = new RemotePeerReferenceMap(AbstractReferenceMap.ReferenceStrength.WEAK,
AbstractReferenceMap.ReferenceStrength.WEAK, true);
automationBackingStore = new ReferenceMap(AbstractReferenceMap.ReferenceStrength.WEAK,
AbstractReferenceMap.ReferenceStrength.WEAK, true);
automationIndices = new HashMap<>();
setAutomationEnabled(true);
}
示例5: LocatorLookup
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
public LocatorLookup(String qname, TransactionIF txn, TopicMapIF tm, int lrusize, E nullObject) {
this.qname = qname;
this.txn = txn;
this.tm = tm;
this.lrusize = lrusize;
this.cache = new ReferenceMap<LocatorIF, E>(AbstractReferenceMap.ReferenceStrength.SOFT, AbstractReferenceMap.ReferenceStrength.HARD);
this.lru = new LRUMap<LocatorIF, E>(lrusize);
NULLOBJECT = nullObject;
}
示例6: QueryLookup
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
public QueryLookup(String qname, TransactionIF txn, int lrusize, V nullObject) {
this.qname = qname;
this.txn = txn;
this.cache = new ReferenceMap(AbstractReferenceMap.ReferenceStrength.SOFT, AbstractReferenceMap.ReferenceStrength.HARD);
this.lru = new LRUMap(lrusize);
NULLOBJECT = nullObject;
}
示例7: getCustomClassLoader
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
public PhysicalClassLoader getCustomClassLoader(Resource[] resources, boolean reload) throws IOException{
if(ArrayUtil.isEmpty(resources)) return this;
String key = hash(resources);
if(reload && customCLs!=null) customCLs.remove(key);
PhysicalClassLoader pcl=customCLs==null?null:customCLs.get(key);
if(pcl!=null) return pcl;
pcl=new PhysicalClassLoader(config,getDirectory(),new ClassLoader[]{new ResourceClassLoader(resources,getParent())},true);
if(customCLs==null)customCLs=new ReferenceMap<String,PhysicalClassLoader>();
customCLs.put(key, pcl);
return pcl;
}
示例8: getCustomResourceClassLoader2
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
public ResourceClassLoader getCustomResourceClassLoader2(Resource[] resources) throws IOException{
if(ArrayUtil.isEmpty(resources)) return this;
String key = hash(resources);
ResourceClassLoader rcl=customCLs==null?null:customCLs.get(key);
if(rcl!=null) return rcl;
rcl=new ResourceClassLoader(resources,this);
if(customCLs==null)customCLs=new ReferenceMap<String,ResourceClassLoader>();
customCLs.put(key, rcl);
return rcl;
}
示例9: createContractStoreMap
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private Map<Serializable, IEntity> createContractStoreMap() {
return new ReferenceMap(AbstractReferenceMap.ReferenceStrength.HARD, AbstractReferenceMap.ReferenceStrength.WEAK,
true);
}
示例10: createSoftHashMap
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
private <K, V> Map<K, V> createSoftHashMap() {
return new ReferenceMap<K, V>(AbstractReferenceMap.ReferenceStrength.SOFT, AbstractReferenceMap.ReferenceStrength.HARD);
}
示例11: getProcedureColumnCache
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
public Map<String,ProcMetaCollection> getProcedureColumnCache() {
if(procedureColumnCache==null)
procedureColumnCache=new ReferenceMap<String,ProcMetaCollection>();
return procedureColumnCache;
}
示例12: BidiReferenceMap
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
public BidiReferenceMap(AbstractReferenceMap.ReferenceStrength keyType, AbstractReferenceMap.ReferenceStrength valueType, int capacity, float loadFactor, boolean purgeValues){
super(new ReferenceMap<K,V>(keyType,valueType,capacity,loadFactor,purgeValues),
new ReferenceMap<V,K>(keyType,valueType,capacity,loadFactor,purgeValues),null);
}
示例13: StructImpl
import org.apache.commons.collections4.map.ReferenceMap; //导入依赖的package包/类
/**
* This implementation spares its clients from the unspecified,
* generally chaotic ordering provided by normally Struct ,
* without incurring the increased cost associated with TreeMap.
* It can be used to produce a copy of a map that has the same order as the original
* @param type
* @param initialCapacity initial capacity - MUST be a power of two.
*/
public StructImpl(int type, int initialCapacity) {
if(type==TYPE_WEAKED) map=new SyncMap<Collection.Key, Object>(new WeakHashMapPro<Collection.Key,Object>(initialCapacity));
else if(type==TYPE_SOFT) map=new SyncMap<Collection.Key, Object>(new MapProWrapper<Collection.Key, Object>(new ReferenceMap<Collection.Key, Object>(HARD,SOFT,initialCapacity,0.75f),new SerializableObject()));
else if(type==TYPE_LINKED) map=new SyncMap<Collection.Key, Object>(new LinkedHashMapPro<Collection.Key,Object>(initialCapacity));
else if(type==TYPE_LINKED_NOT_SYNC) map=new LinkedHashMapPro<Collection.Key,Object>(initialCapacity);
else map=MapFactory.getConcurrentMap(initialCapacity);
}