Most visited

Recently visited

Added in API level 1

ReferenceQueue

public class ReferenceQueue
extends Object

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


引用队列,在检测到适当的可访问性更改后,垃圾收集器会将已注册的引用对象附加到该引用队列。

摘要(Summary)

Public constructors

ReferenceQueue()

构造一个新的引用对象队列。

公共方法(Public methods)

Reference<? extends T> poll()

轮询此队列以查看引用对象是否可用。

Reference<? extends T> remove(long timeout)

删除此队列中的下一个引用对象,直到其中一个变为可用或给定的超时时间到期为止。

Reference<? extends T> remove()

删除此队列中的下一个引用对象,直到其中一个变为可用。

继承方法(Inherited methods)

From class java.lang.Object

Public constructors

ReferenceQueue

Added in API level 1
ReferenceQueue ()

构造一个新的引用对象队列。

公共方法(Public methods)

poll

Added in API level 1
Reference<? extends T> poll ()

轮询此队列以查看引用对象是否可用。 如果有一个没有进一步的延迟可用,那么它将从队列中移除并返回。 否则,此方法立即返回null

返回(Returns)
Reference<? extends T> A reference object, if one was immediately available, otherwise null

remove

Added in API level 1
Reference<? extends T> remove (long timeout)

删除此队列中的下一个引用对象,直到其中一个变为可用或给定的超时时间到期为止。

此方法不提供实时保证:它通过调用 wait(long)方法调度超时。

参数(Parameters)
timeout long: If positive, block for up to timeout milliseconds while waiting for a reference to be added to this queue. If zero, block indefinitely.
返回(Returns)
Reference<? extends T> A reference object, if one was available within the specified timeout period, otherwise null
抛出异常(Throws)
IllegalArgumentException If the value of the timeout argument is negative
InterruptedException If the timeout wait is interrupted

remove

Added in API level 1
Reference<? extends T> remove ()

删除此队列中的下一个引用对象,直到其中一个变为可用。

返回(Returns)
Reference<? extends T> A reference object, blocking until one becomes available
抛出异常(Throws)
InterruptedException If the wait is interrupted

Hooray!