protected SortedMap _sortedWaitingWriters=new SyncSortedMap(new TreeMap(new Comparator() { public int compare(Object o1, Object o2) { return ((Thread)o2).getPriority()-((Thread)o1).getPriority(); } }), new Mutex()) synchronized (this){...;this.wait();...} becomes synchronized(lock){...;lock.wait();...} you must synchronize on lock to wake up a thread - this ensures that: 1. the thread is actually wait()-ing 2. you own the monitor _writerQueue is synched separately... a thread can release() and try to notify() a waiting thread - if the thread is not yet waiting the notify will wait. put in an assert to check that the thread is not already in the writer list... 1, wait, loop(try(2)catch(3,next-writer, next-reader)) end-wait,..., next-reader-or-writer inline endWrite() and maybe signalNextWriter() (notifyNextWriter()) maybe have a look at Doug's src for 1.5 explain why this lock is so important How about keeping a final array of MAX_THREAD objects and queueing each writer thread against the corresponding priority object and incrementing a counter. The Object would contain a counter and synchronised incr/decr/getCount() methods. contending threads would be split MAX-MIN_THREAD ways - more efficient than normal lock !! wait()-ing and notify()-ing an object would only involve synching on the lock object... FEATURE TABLE -------------- Impl Persistant? Evicting? Replicating? Whole/Delta? 1->all/n | author - shared-store? --------------------------------|-----------|---------|------------|------------|----- WADI | | | NYI | | | jules JETTY DSM | | | Y | D | | jules JETTY DSM/JBoss | | | | | | jules TC4/JBoss | | | | | | ?? TC5 PersistentManager | Y | Y | | | | Kief - use store as backup TC5 DeltaManager | | | | | | filip,craig,jean-francois TC5 SimpleTcpReplicationManager | | | | | | filip, bela ???? | | | Y | | | rob block