public class IQuotaFlusher<RequestType,ResponseType> implements IFlusher<RequestType,ResponseType>
定量刷盘
IFlusher.DefaultImpls| 构造器和说明 |
|---|
IQuotaFlusher(int flushQuota)
定量刷盘
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
currIndex()
获得当前索引
|
void |
doFlush(int oldIndex)
处理旧索引的请求
|
void |
flush(boolean byTimeout)
将积累的请求刷掉
|
java.util.concurrent.ExecutorService |
getExecutor()
执行线程(池)
|
int |
getFlushQuota() |
AtomicLock |
getLock()
限制定时+定量并发调用flush()的锁
|
boolean |
getSwitch()
开关, 2值的轮换
|
boolean |
isRequestEmpty()
请求是否为空
|
void |
setSwitch(boolean p)
开关, 2值的轮换
|
void |
tryFlushWhenAdd(int currRequestCount)
空 -> 非空: 尝试定量刷盘
在添加请求时调用
|
add, flush, isRequestEmpty, requestCountpublic java.util.concurrent.ExecutorService getExecutor()
执行线程(池)
public AtomicLock getLock()
限制定时+定量并发调用flush()的锁
public boolean getSwitch()
开关, 2值的轮换
public void setSwitch(boolean p)
开关, 2值的轮换
public int currIndex()
获得当前索引
public void tryFlushWhenAdd(int currRequestCount)
空 -> 非空: 尝试定量刷盘 在添加请求时调用
public void flush(boolean byTimeout)
将积累的请求刷掉
public void doFlush(int oldIndex)
处理旧索引的请求
public int getFlushQuota()
public boolean isRequestEmpty()
请求是否为空