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(); }
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; }
@SuppressWarnings("unchecked") private ResourceManager() { // resources = new HashMap<String, IResource>(); resources = new ReferenceMap(AbstractReferenceMap.ReferenceStrength.SOFT, AbstractReferenceMap.ReferenceStrength.SOFT, true); random = new SecureRandom(); }
/** * 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); }
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; }
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; }
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; }
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; }
@SuppressWarnings("unchecked") private Map<Serializable, IEntity> createContractStoreMap() { return new ReferenceMap(AbstractReferenceMap.ReferenceStrength.HARD, AbstractReferenceMap.ReferenceStrength.WEAK, true); }
private <K, V> Map<K, V> createSoftHashMap() { return new ReferenceMap<K, V>(AbstractReferenceMap.ReferenceStrength.SOFT, AbstractReferenceMap.ReferenceStrength.HARD); }
public Map<String,ProcMetaCollection> getProcedureColumnCache() { if(procedureColumnCache==null) procedureColumnCache=new ReferenceMap<String,ProcMetaCollection>(); return procedureColumnCache; }
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); }
/** * 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); }