Mercurial > hg > Applications > TreeVNC
view src/main/java/jp/ac/u_ryukyu/treevnc/MostRecentMultiCast.java @ 35:1b81deb0abb3
write a little part reconnection.
author | one |
---|---|
date | Wed, 12 Sep 2012 13:16:47 +0900 |
parents | 12c3a73be47f |
children |
line wrap: on
line source
package jp.ac.u_ryukyu.treevnc; 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(); } } }