public Iterator<V> iterator() { expungeStaleEntries(); return new Iterator<V>() { protected Iterator<WeakEntry<V>> it = contents.values().iterator(); public boolean hasNext() { return it.hasNext(); } public V next() { WeakObject<V> ret = (WeakObject<V>)it.next(); return ret!=null ? ret.get() : null; } public void remove() { it.remove(); } }; }
public int size() { return WeakValueMap.this.size(); } };
/** * Create a new remote reference module. */ public RemoteReferenceModule(RemoteServiceManagementService rsms, ILibraryService libservice, IMarshalService marshalservice) { this.rsms = rsms; this.libservice = libservice; this.marshalservice = marshalservice; this.timer = new Timer(true); this.proxyinfos = new LRU<Object, ProxyInfo>(200); this.targetobjects = new HashMap<RemoteReference, Object>(); this.targetcomps = new WeakValueMap(); // <RemoteReference, Object> this.remoterefs = new WeakHashMap<Object, RemoteReference> (); this.proxycount = new HashMap<RemoteReference, Integer>(); this.proxydates = new TreeMap<Long, RemoteReference>(); this.holders = new HashMap<RemoteReference, Map<RemoteReferenceHolder, RemoteReferenceHolder>>(); }
/** * Add all mappings. */ public void putAll(Map<? extends K, ? extends V> m) { for(Iterator<? extends K> it=m.keySet().iterator(); it.hasNext(); ) { K key = it.next(); put(key, m.get(key)); } }
/** * Create a new remote reference module. */ public RemoteReferenceModule(RemoteServiceManagementService rsms, ILibraryService libservice, IMarshalService marshalservice) { this.rsms = rsms; this.libservice = libservice; this.marshalservice = marshalservice; this.timer = new Timer(true); this.proxyinfos = new LRU<Object, ProxyInfo>(200); this.targetobjects = new HashMap<RemoteReference, Object>(); this.targetcomps = new WeakValueMap(); // <RemoteReference, Object> this.remoterefs = new WeakHashMap<Object, RemoteReference> (); this.proxycount = new HashMap<RemoteReference, Integer>(); this.proxydates = new TreeMap<Long, RemoteReference>(); this.holders = new HashMap<RemoteReference, Map<RemoteReferenceHolder, RemoteReferenceHolder>>(); }
/** * Create a new remote reference module. */ public RemoteReferenceModule(RemoteServiceManagementService rsms, ILibraryService libservice, IMarshalService marshalservice) { this.rsms = rsms; this.libservice = libservice; this.marshalservice = marshalservice; this.timer = new Timer(true); this.proxyinfos = new LRU<Object, ProxyInfo>(200); this.targetobjects = new HashMap<RemoteReference, Object>(); this.targetcomps = new WeakValueMap(); // <RemoteReference, Object> this.remoterefs = new WeakHashMap<Object, RemoteReference> (); this.proxycount = new HashMap<RemoteReference, Integer>(); this.proxydates = new TreeMap<Long, RemoteReference>(); this.holders = new HashMap<RemoteReference, Map<RemoteReferenceHolder, RemoteReferenceHolder>>(); }
/** * Get the size. */ public int size() { expungeStaleEntries(); return contents.size(); }
public int size() { return WeakValueMap.this.size(); } };
/** * Check if empty. */ public boolean isEmpty() { expungeStaleEntries(); return contents.isEmpty(); }
public int size() { return WeakValueMap.this.size(); } };
/** * Test if key contained. */ public boolean containsKey(Object key) { expungeStaleEntries(); return contents.containsKey(key); }
/** * Clear the map. */ public void clear() { expungeStaleEntries(); contents.clear(); }
/** * Test if value contained. */ public boolean containsValue(Object value) { expungeStaleEntries(); return contents.containsValue(value); }
public Iterator<K> iterator() { expungeStaleEntries(); return contents.keySet().iterator(); }
/** * Get value for key. */ public V get(Object key) { expungeStaleEntries(); WeakObject<V> ret = (WeakObject<V>)contents.get(key); return ret!=null ? ret.get() : null; }
/** * Remove value for key. */ public V remove(Object key) { expungeStaleEntries(); WeakEntry<V> ret = contents.remove(key); return ret!=null ? ret.get() : null; }
public Iterator<Entry<K, V>> iterator() expungeStaleEntries(); final Iterator<Entry<K, WeakEntry<V>>> oit = contents.entrySet().iterator(); Iterator<Entry<K, V>> it = new Iterator<Entry<K, V>>()
/** * Add value for key. */ public V put(final K key, V value) { expungeStaleEntries(); WeakEntry<V> ret; if(value!=null) { WeakEntry<V> we = new WeakEntry<V>(value, key, queue); ret = contents.put(key, we); } else { ret = contents.put(key, null); } return ret!=null ? ret.get() : null; }