Java 类org.apache.commons.collections4.map.AbstractReferenceMap 实例源码

项目:jspresso-ce    文件:BasicRemotePeerRegistry.java   
@Override
protected <T> Object toReference(AbstractReferenceMap.ReferenceStrength type, T referent, int hash) {
  if (referent instanceof IRemotePeer) {
    RemotePeerReferenceMap<?,?> parent;
    try {
      parent = (RemotePeerReferenceMap) ReflectHelper.getPrivateFieldValue(
          AbstractReferenceMap.ReferenceEntry.class, "parent", this);
    } catch (Exception e) {
      throw new RuntimeException("An unexpected runtime exception occurred", e);
    }
    switch (type) {
      case SOFT:
        return new RemotePeerSoftRef(hash, (IRemotePeer) referent, parent.remotePeerQueue);
      case WEAK:
        return new RemotePeerWeakRef(hash, (IRemotePeer) referent, parent.remotePeerQueue);
      default:
        break;
    }
  }
  return super.toReference(type, referent, hash);
}
项目:ontopia    文件:AbstractTransaction.java   
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();
}
项目:jspresso-ce    文件:ResourceManager.java   
@SuppressWarnings("unchecked")
private ResourceManager() {
  // resources = new HashMap<String, IResource>();
  resources = new ReferenceMap(AbstractReferenceMap.ReferenceStrength.SOFT,
      AbstractReferenceMap.ReferenceStrength.SOFT, true);
  random = new SecureRandom();
}
项目:jspresso-ce    文件:BasicRemotePeerRegistry.java   
/**
 * 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);
}
项目:jspresso-ce    文件:BasicRemotePeerRegistry.java   
@Override
protected AbstractReferenceMap.ReferenceEntry<K, V> createEntry(HashEntry<K, V> next, int hashCode, K key, V value) {
  if (value instanceof IRemotePeer) {
    return new RemotePeerReferenceEntry(this, next, hashCode, key, value);
  }
  return super.createEntry(next, hashCode, key, value);
}
项目:ontopia    文件:LocatorLookup.java   
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;
}
项目:ontopia    文件:QueryLookup.java   
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;
 }
项目:jgs    文件:ObjectMap.java   
/**
 * Constructor.
 */
private ObjectMap() {
    globalPC = new LinkedList<Object>();
    globalPC.push(SecurityLevel.bottom()); 
    actualReturnLevel = SecurityLevel.top();
    actualArguments = new ArrayList<Object>();
    innerMap = new ReferenceIdentityMap<Object, 
            HashMap<String, Object>>(
            AbstractReferenceMap.ReferenceStrength.WEAK, 
            AbstractReferenceMap.ReferenceStrength.WEAK);   
}
项目:jgs    文件:ObjectMap.java   
/**
 * Constructor.
 */
private ObjectMap() {
    globalPC = new LinkedList<Object>();
    globalPC.push(CurrentSecurityDomain.bottom());
    actualReturnLevel = CurrentSecurityDomain.bottom();     // was top!?!
    actualArguments = new ArrayList<Object>();
    innerMap = new ReferenceIdentityMap<Object, 
            HashMap<String, Object>>(
            AbstractReferenceMap.ReferenceStrength.WEAK, 
            AbstractReferenceMap.ReferenceStrength.WEAK);   
}
项目:jspresso-ce    文件:BasicEntityRegistry.java   
@SuppressWarnings("unchecked")
private Map<Serializable, IEntity> createContractStoreMap() {
  return new ReferenceMap(AbstractReferenceMap.ReferenceStrength.HARD, AbstractReferenceMap.ReferenceStrength.WEAK,
      true);
}
项目:jspresso-ce    文件:BasicRemotePeerRegistry.java   
public RemotePeerReferenceMap(AbstractReferenceMap.ReferenceStrength keyType,
                              AbstractReferenceMap.ReferenceStrength valueType, boolean purgeValues) {
  super(keyType, valueType, purgeValues);
}
项目:ontopia    文件:DefaultCaches.java   
private <K, V> Map<K, V> createSoftHashMap() {
  return new ReferenceMap<K, V>(AbstractReferenceMap.ReferenceStrength.SOFT, AbstractReferenceMap.ReferenceStrength.HARD);
}
项目:ontopia    文件:JGroupsCaches.java   
private <K, V> Map<K, V> createSoftHashMap() {
  return new ReferenceMap<K, V>(AbstractReferenceMap.ReferenceStrength.SOFT, AbstractReferenceMap.ReferenceStrength.HARD);
}
项目:terminal-recall    文件:BidiReferenceMap.java   
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);
   }
项目:terminal-recall    文件:BidiReferenceMap.java   
public BidiReferenceMap(AbstractReferenceMap.ReferenceStrength keyValueType){
this(keyValueType,keyValueType,16,0.75f,true);
   }