com.alibaba.rocketmq.store
类 ReferenceResource

java.lang.Object
  继承者 com.alibaba.rocketmq.store.ReferenceResource
直接已知子类:
MapedFile

public abstract class ReferenceResource
extends Object

引用计数基类,类似于C++智能指针实现

从以下版本开始:
2013-7-21
作者:
shijia.wxr

字段摘要
protected  boolean available
           
protected  boolean cleanupOver
           
protected  AtomicLong refCount
           
 
构造方法摘要
ReferenceResource()
           
 
方法摘要
abstract  boolean cleanup(long currentRef)
           
 long getRefCount()
           
 boolean hold()
          资源是否能HOLD住
 boolean isAvailable()
          资源是否可用,即是否可被HOLD
 boolean isCleanupOver()
          资源是否被清理完成
 void release()
          释放资源
 void shutdown(long intervalForcibly)
          禁止资源被访问 shutdown不允许调用多次,最好是由管理线程调用
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

refCount

protected final AtomicLong refCount

available

protected volatile boolean available

cleanupOver

protected volatile boolean cleanupOver
构造方法详细信息

ReferenceResource

public ReferenceResource()
方法详细信息

hold

public boolean hold()
资源是否能HOLD住


isAvailable

public boolean isAvailable()
资源是否可用,即是否可被HOLD


shutdown

public void shutdown(long intervalForcibly)
禁止资源被访问 shutdown不允许调用多次,最好是由管理线程调用


getRefCount

public long getRefCount()

release

public void release()
释放资源


cleanup

public abstract boolean cleanup(long currentRef)

isCleanupOver

public boolean isCleanupOver()
资源是否被清理完成



Copyright © 2012–2015. All rights reserved.