public static <B> BeanPropertyAccessor<B> forClass(Class<B> clazz, PropertySet set) { synchronized (cAccessors) { Map<Class, SoftReference<BeanPropertyAccessor>> accessors = cAccessors.get(set); if (accessors == null) { accessors = new WeakIdentityMap<Class, SoftReference<BeanPropertyAccessor>>(); cAccessors.put(set, accessors); } BeanPropertyAccessor bpa; SoftReference<BeanPropertyAccessor> ref = accessors.get(clazz); if (ref != null) { bpa = ref.get(); if (bpa != null) { return bpa; } } bpa = generate(clazz, set); accessors.put(clazz, new SoftReference<BeanPropertyAccessor>(bpa)); return bpa; } }
public TransactionManager(TransactionMonitor monitor) { mLocalScope = new ThreadLocal<TransactionScope<Txn>>(); mAllScopes = new WeakIdentityMap(); mMonitor = monitor; }
public TransactionManager(TransactionMonitor monitor) { mLocalScope = new ThreadLocal<TransactionScope<Txn>>(); mAllScopes = new WeakIdentityMap(); mMonitor = monitor; }
public QueryExecutorCache(QueryExecutorFactory<S> factory) { if (factory == null) { throw new IllegalArgumentException(); } mFactory = factory; mPrimaryCache = new LinkedHashMap<Key<S>, QueryExecutor<S>>(17, 0.75f, true) { @Override protected boolean removeEldestEntry(Map.Entry<Key<S>, QueryExecutor<S>> eldest) { return size() > cMinCapacity; } }; mFilterToExecutor = new WeakIdentityMap(7); }
public QueryExecutorCache(QueryExecutorFactory<S> factory) { if (factory == null) { throw new IllegalArgumentException(); } mFactory = factory; mPrimaryCache = new LinkedHashMap<Key<S>, QueryExecutor<S>>(17, 0.75f, true) { @Override protected boolean removeEldestEntry(Map.Entry<Key<S>, QueryExecutor<S>> eldest) { return size() > cMinCapacity; } }; mFilterToExecutor = new WeakIdentityMap(7); }
/** * @param lazySetExecutor by default, query executors are built and set * eagerly. Pass true to build and set executor on first query use. */ protected StandardQueryFactory(Class<S> type, boolean lazySetExecutor) { if (type == null) { throw new IllegalArgumentException(); } mType = type; mLazySetExecutor = lazySetExecutor; mStringToQuery = SoftValuedCache.newCache(7); mFilterToQuery = new WeakIdentityMap(7); }
/** * @param lazySetExecutor by default, query executors are built and set * eagerly. Pass true to build and set executor on first query use. */ protected StandardQueryFactory(Class<S> type, boolean lazySetExecutor) { if (type == null) { throw new IllegalArgumentException(); } mType = type; mLazySetExecutor = lazySetExecutor; mStringToQuery = SoftValuedCache.newCache(7); mFilterToQuery = new WeakIdentityMap(7); }
public static <K, V> Cache<K, V> newWeakIdentityCache(int capacity) { try { return Inner.newWeakIdentityCache(capacity); } catch (NoClassDefFoundError e) { // Use older class for compatibility. return wrap(new org.cojen.util.WeakIdentityMap<K, V>(capacity)); } }
cAbstractCache = new WeakIdentityMap();
cAbstractCache = new WeakIdentityMap();