public class LeaseTimeCollection<E> extends java.lang.Object implements ILeaseTimeCollection<E>
| Modifier and Type | Class and Description | 
|---|---|
| class  | LeaseTimeCollection.CheckerThe checker for removing entries. | 
| static class  | LeaseTimeCollection.SynchronizedLeaseTimeCollection<E>Synchronized lease time collection. | 
| Modifier and Type | Field and Description | 
|---|---|
| protected LeaseTimeCollection.Checker | checkerThe current checker. | 
| protected java.util.PriorityQueue<E> | entriesThe entries. | 
| protected long | leasetimeThe leasetime. | 
| static long | NONEConstant for no leasetime. | 
| protected ICommand<E> | removecmdThe cleaner. | 
| protected IDelayRunner | timerThe timer. | 
| protected java.util.Map<E,java.lang.Long> | timesThe timestamps. | 
| static long | UNSETConstant for unset leasetime (use global default otherwise no leasetime). | 
| Modifier | Constructor and Description | 
|---|---|
| protected  | LeaseTimeCollection()Create a new lease time handling object. | 
| protected  | LeaseTimeCollection(ICommand<E> removecmd)Create a new lease time handling object. | 
| protected  | LeaseTimeCollection(long leasetime)Create a new lease time handling object. | 
| protected  | LeaseTimeCollection(long leasetime,
                   ICommand<E> removecmd)Create a new lease time handling object. | 
| protected  | LeaseTimeCollection(long leasetime,
                   ICommand<E> removecmd,
                   IDelayRunner timer)Create a new lease time handling object. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | add(E e) | 
| boolean | add(E e,
   long leasetime)Add a new entry. | 
| boolean | addAll(java.util.Collection<? extends E> c) | 
| void | checkStale()Start removing discovered proxies. | 
| void | clear() | 
| boolean | contains(java.lang.Object o) | 
| boolean | containsAll(java.util.Collection<?> c) | 
| static <E> ILeaseTimeCollection<E> | createLeaseTimeCollection(long leasetime)Create a lease time collection with java util timer. | 
| static <E> ILeaseTimeCollection<E> | createLeaseTimeCollection(long leasetime,
                         ICommand<E> removecmd)Create a lease time collection with java util timer. | 
| static <E> ILeaseTimeCollection<E> | createLeaseTimeCollection(long leasetime,
                         ICommand<E> removecmd,
                         IDelayRunner timer,
                         boolean sync)Create a lease time collection with java util timer. | 
| void | dispose()Release all resources. | 
| java.lang.Runnable | doWaitFor(long delay,
         java.lang.Runnable step)Overriden wait for to not use platform clock. | 
| boolean | equals(java.lang.Object o) | 
| protected long | getClockTime()Get the current time. | 
| protected java.lang.Long | getExpirationTime(long leasetime)Get the expiration time. | 
| long | getLeaseTime()Get the leasetime. | 
| int | hashCode()Get the hashcode. | 
| boolean | isEmpty() | 
| java.util.Iterator<E> | iterator() | 
| static void | main(java.lang.String[] args)Main for testing. | 
| boolean | remove(java.lang.Object o) | 
| boolean | removeAll(java.util.Collection<?> c) | 
| boolean | retainAll(java.util.Collection<?> c) | 
| int | size() | 
| java.lang.Object[] | toArray() | 
| <T> T[] | toArray(T[] a) | 
| void | touch(E e)Update the timestamp of e. | 
| void | touch(E e,
     long leasetime)Update the timestamp of e. | 
| boolean | update(E e)Add a new entry or update an existing entry. | 
| boolean | update(E e,
      long leasetime)Add a new entry or update an existing entry. | 
public static final long NONE
public static final long UNSET
protected java.util.PriorityQueue<E> entries
protected java.util.Map<E,java.lang.Long> times
protected IDelayRunner timer
protected long leasetime
protected LeaseTimeCollection.Checker checker
protected LeaseTimeCollection()
protected LeaseTimeCollection(long leasetime)
protected LeaseTimeCollection(ICommand<E> removecmd)
protected LeaseTimeCollection(long leasetime,
                              ICommand<E> removecmd)
protected LeaseTimeCollection(long leasetime,
                              ICommand<E> removecmd,
                              IDelayRunner timer)
public static <E> ILeaseTimeCollection<E> createLeaseTimeCollection(long leasetime)
public static <E> ILeaseTimeCollection<E> createLeaseTimeCollection(long leasetime, ICommand<E> removecmd)
public static <E> ILeaseTimeCollection<E> createLeaseTimeCollection(long leasetime, ICommand<E> removecmd, IDelayRunner timer, boolean sync)
public int size()
size in interface java.util.Collection<E>public boolean isEmpty()
isEmpty in interface java.util.Collection<E>public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<E>public java.util.Iterator<E> iterator()
public java.lang.Object[] toArray()
toArray in interface java.util.Collection<E>public <T> T[] toArray(T[] a)
toArray in interface java.util.Collection<E>public boolean add(E e, long leasetime)
ILeaseTimeCollectionadd in interface ILeaseTimeCollection<E>e - The entry.leasetime - The leasetime.public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<E>public boolean containsAll(java.util.Collection<?> c)
containsAll in interface java.util.Collection<E>public boolean addAll(java.util.Collection<? extends E> c)
addAll in interface java.util.Collection<E>public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<E>public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<E>public void clear()
clear in interface java.util.Collection<E>public boolean equals(java.lang.Object o)
equals in interface java.util.Collection<E>equals in class java.lang.Objectpublic int hashCode()
hashCode in interface java.util.Collection<E>hashCode in class java.lang.Objectpublic boolean update(E e)
update in interface ILeaseTimeCollection<E>entry - The entry.public boolean update(E e, long leasetime)
update in interface ILeaseTimeCollection<E>entry - The entry.public void touch(E e)
touch in interface ILeaseTimeCollection<E>entry - The entry.public void touch(E e, long leasetime)
touch in interface ILeaseTimeCollection<E>entry - The entry.protected java.lang.Long getExpirationTime(long leasetime)
leasetime - public void checkStale()
public java.lang.Runnable doWaitFor(long delay,
                                    java.lang.Runnable step)
protected long getClockTime()
public long getLeaseTime()
public void dispose()
public static void main(java.lang.String[] args)