aicas logoJamaica 3.2 release 62

java.lang.ref
Class ReferenceQueue<T>

java.lang.Object
  extended by java.lang.ref.ReferenceQueue<T>

public class ReferenceQueue<T>
extends Object

ReferenceQueue is a list of (weak, soft or phantom) references that where cleared by the garbage collector. If a reference queue instance is provided to a newly created reference, then this reference will be enqueued automatically in this list when it is cleared by the garbage collector.

Since:
1.2

Constructor Summary
ReferenceQueue()
          Constructor to create an empty reference queue.
 
Method Summary
 Reference<? extends T> poll()
          poll
 Reference<? extends T> remove()
          Remove one element from this queue.
 Reference<? extends T> remove(long timeout)
          Remove one element from this queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferenceQueue

public ReferenceQueue()
Constructor to create an empty reference queue.

Method Detail

poll

public Reference<? extends T> poll()
poll


remove

public Reference<? extends T> remove(long timeout)
                              throws IllegalArgumentException,
                                     InterruptedException
Remove one element from this queue. If no element is present, wait until one element will be queued or the given timeout is reached (whatever comes first).

Parameters:
timeout - a timeout for blocking wait for an element in the list, in milliseconds. A timeout of 0 will block forever.
Returns:
the reference that was removed, or null if the queue is empty even after the timeout has passed.
Throws:
IllegalArgumentException - if timeout is negative
InterruptedException - if the blocking wait was interrupted via a call to Thread.interrupt().

remove

public Reference<? extends T> remove()
                              throws InterruptedException
Remove one element from this queue. If no element is present, wait until one element will be queued.

Returns:
the reference that was removed, or null if the queue is empty even after the timeout has passed.
Throws:
InterruptedException - if the blocking wait was interrupted via a call to Thread.interrupt().

aicas logoJamaica 3.2 release 62

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2008 aicas GmbH. All Rights Reserved.