Mercurial > hg > Members > nobuyasu > tightVNCProxy
view src/myVncProxy/MostRecentMultiCast.java @ 86:b7225991184b
refactor for tests
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 03 Aug 2011 08:05:51 +0900 |
parents | 0cbe556e2c54 |
children |
line wrap: on
line source
package myVncProxy; import java.util.LinkedList; public class MostRecentMultiCast<T> extends MulticastQueue<T> { LinkedList<Node<T>> alive; int count = 0; MostRecentMultiCast(int limit) { count = limit; this.alive = new LinkedList<Node<T>>(); } @Override public synchronized void put(T item) { Node<T> next = new Node<T>(item); tail.set(next); tail = next; alive.addLast(next); if (alive.size()>count) { Node<T> old = alive.getFirst(); old.clear(); } } }