java.lang.ref.Reference.isEnqueued()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中java.lang.ref.Reference.isEnqueued方法的一些代码示例,展示了Reference.isEnqueued的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.isEnqueued方法的具体详情如下:
包路径:java.lang.ref.Reference
类名称:Reference
方法名:isEnqueued

Reference.isEnqueued介绍

[英]Checks whether the reference object has been enqueued.
[中]检查引用对象是否已排队。

代码示例

代码示例来源:origin: com.github.marcosemiao.log4jdbc/log4jdbc-utils

public boolean isEnqueued() {
  return reference.isEnqueued();
}

代码示例来源:origin: stackoverflow.com

SoftReference<Object> sr = new SoftReference<Object>(new Object(),new ReferenceQueue<Object>());
public boolean underPressure(){
  if (sr.isEnqueued()) {
    // recreate object to monitor
    sr = new SoftReference<Object>(new Object(),new ReferenceQueue<Object>());
    return true;
  }
  return false;
}

代码示例来源:origin: jasperreports/jasperreports

protected JRVirtualizable getMapValue(Object val)
{
  JRVirtualizable o;
  if (val == null)
  {
    o = null;
  }
  else
  {
    Reference ref = (Reference) val;
    if (ref.isEnqueued())
    {
      o = null;
    }
    else
    {
      o = (JRVirtualizable) ref.get();
    }
  }
  return o;
}

代码示例来源:origin: org.arakhne.afc.core/references

/** Clean the references that was released.
 */
public final void expurge() {
  Reference<? extends E> obj;
  final Iterator<R> iter = this.theSet.iterator();
  R reference;
  while (iter.hasNext()) {
    reference = iter.next();
    if (reference != null
        && ((reference.isEnqueued()) || (reference.get() == null))) {
      reference.enqueue();
      reference.clear();
    }
  }
  while ((obj = this.queue.poll()) != null) {
    obj.clear();
    if (this.referenceType.isInstance(obj)) {
      this.theSet.remove(this.referenceType.cast(obj));
    }
  }
}

代码示例来源:origin: stackoverflow.com

assertThat(isEnqueued()).as("Object: " + leakedObjectDescription + " was leaked").isTrue();

代码示例来源:origin: org.arakhne.afc.core/references

for (int i = 0; i < this.size; ++i) {
  ref = (Reference<T>) this.data[i];
  if ((ref == null) || (ref.isEnqueued()) || (ref.get() == null)) {
    if (ref != null) {
      ref.clear();

相关文章