Changeset 25

Show
Ignore:
Timestamp:
01/03/06 16:05:14 (3 years ago)
Author:
schst
Message:

Added private constructor, added getDetachedInstance(), replace WeakHashmap? by a Hashmap

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/net/schst/EventDispatcher/EventDispatcher.java

    r24 r25  
    1919    * Stores all listeners 
    2020    */ 
    21     private WeakHashMap listeners = new WeakHashMap(); 
     21    private HashMap listeners = new HashMap(); 
    2222 
    2323   /** 
     
    3838    private EventQueue queue = new EventQueue(); 
    3939     
     40    /** 
     41     * Constructor is private. 
     42     * 
     43     * Use getInstance() or getDetachedInstance() instead. 
     44     */ 
     45    private EventDispatcher() { 
     46    } 
     47     
    4048   /** 
    4149    * Get the default dispatcher 
     
    6169    } 
    6270 
     71    /** 
     72     * Get an instance and do not remember it.  
     73     *  
     74     * @return 
     75     */ 
     76    synchronized public static EventDispatcher getDetachedInstance() { 
     77        return new EventDispatcher(); 
     78    } 
     79     
    6380    /** 
    6481     * Detach a dispatcher