Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal.utils
Class SoftHashMap

    java.lang.Object
      java.util.AbstractMap
          org.jasig.portal.utils.SoftHashMap

All Implemented Interfaces:
  java.util.Map

    public class SoftHashMap

extends java.util.AbstractMap

A HashMap implementation that uses soft references, leaving memory management up to the gc.

Version:
  $Revision: 1.4.4.3 $
Author:
  Peter Kharchenko (thanks to Dr. Kabutz on whose article the code is based)

Nested Class Summary
`private static class` | `SoftHashMap.KeyReferencePair` An extension of a SoftReference that contains a key by which it was mapped.

Nested classes/interfaces inherited from interface java.util.Map
`java.util.Map.Entry`

Field Summary
`private java.util.LinkedList` | `fifo`
`private edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap` | `map`
`private int` | `minSize`
`private java.lang.ref.ReferenceQueue` | `removeQueue`

Constructor Summary
`SoftHashMap()`
`SoftHashMap(int minSize)` Construct a SoftHashMap

Method Summary
`private void` | `addToFIFO(java.lang.Object o)`
`private void` | `cleanMap()`
`void` | `clear()`
`java.util.Set` | `entrySet()`
`java.lang.Object` | `get(java.lang.Object key)`
`java.lang.Object` | `put(java.lang.Object key, java.lang.Object value)`
`java.lang.Object` | `remove(java.lang.Object key)`
`int` | `size()`

Methods inherited from class java.util.AbstractMap
`clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, toString, values`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### map

    private final edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap map

### fifo

    private final java.util.LinkedList fifo

### removeQueue

    private final java.lang.ref.ReferenceQueue removeQueue

### minSize

    private int minSize

Constructor Detail

### SoftHashMap

    public SoftHashMap(int minSize)

  Construct a SoftHashMap

  Parameters:
    `minSize` - minimum number of objects to keep (approximate)

### SoftHashMap

    public SoftHashMap()

Method Detail

### put

    public java.lang.Object put(java.lang.Object key,
                                java.lang.Object value)

  Specified by:
    `put` in interface `java.util.Map`
  Overrides:
    `put` in class `java.util.AbstractMap`

### get

    public java.lang.Object get(java.lang.Object key)

  Specified by:
    `get` in interface `java.util.Map`
  Overrides:
    `get` in class `java.util.AbstractMap`

### remove

    public java.lang.Object remove(java.lang.Object key)

  Specified by:
    `remove` in interface `java.util.Map`
  Overrides:
    `remove` in class `java.util.AbstractMap`

### size

    public int size()

  Specified by:
    `size` in interface `java.util.Map`
  Overrides:
    `size` in class `java.util.AbstractMap`

### clear

    public void clear()

  Specified by:
    `clear` in interface `java.util.Map`
  Overrides:
    `clear` in class `java.util.AbstractMap`

### entrySet

    public java.util.Set entrySet()

  Specified by:
    `entrySet` in interface `java.util.Map`
  Specified by:
    `entrySet` in class `java.util.AbstractMap`

### addToFIFO

    private void addToFIFO(java.lang.Object o)

### cleanMap

    private void cleanMap()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD