net.neoremind.fountain.common.mq
类 AbstractMaxCapacityFountainMQ

java.lang.Object
  继承者 net.neoremind.fountain.common.mq.AbstractMaxCapacityFountainMQ
所有已实现的接口:
FountainMQ
直接已知子类:
MemFountainMQ, MultiPermitsMemFountainMQ

public abstract class AbstractMaxCapacityFountainMQ
extends Object
implements FountainMQ

内存队列实现的抽象类. 使用无界BlockingQueue保存消息,使用guardLimit控制消息数量

作者:
hexiufeng,zhangxu

字段摘要
protected  int limitSize
          队列容量上限
 
构造方法摘要
protected AbstractMaxCapacityFountainMQ(int limit)
          构造方法
 
方法摘要
protected abstract  int getRequiredPermits(BinlogTraceable e)
          从一个数据消息中获取需要权限的个数
 BinlogTraceable pop()
          从队列中读取一个消息,如果队列中没有消息,则堵塞直到有一个消息进入
 BinlogTraceable pop(long timeout)
          从队列中读取一个消息,支持超时版本,如果队列中没有消息,则堵塞直到有一个消息进入 或者超时,超时时返回false
 void push(BinlogTraceable e)
          push一个消息,对于有界mq,如果容量已满,此方法会堵塞直到容量被至少是否一个unit
 boolean push(BinlogTraceable e, long timeout)
          push 一个消息,支持超时的版本,如果容量已满,此方法会堵塞直到容量被至少是否一个unit 或者超时,超时时返回false
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
从接口 net.neoremind.fountain.common.mq.FountainMQ 继承的方法
isExceedMaxCapacity
 

字段详细信息

limitSize

protected final int limitSize
队列容量上限

构造方法详细信息

AbstractMaxCapacityFountainMQ

protected AbstractMaxCapacityFountainMQ(int limit)
构造方法

参数:
limit - 队列容量的上限
方法详细信息

getRequiredPermits

protected abstract int getRequiredPermits(BinlogTraceable e)
从一个数据消息中获取需要权限的个数

参数:
e - 消息
返回:
权限个数

push

public void push(BinlogTraceable e)
从接口 FountainMQ 复制的描述
push一个消息,对于有界mq,如果容量已满,此方法会堵塞直到容量被至少是否一个unit

指定者:
接口 FountainMQ 中的 push
参数:
e - 需要加入队列的元素

push

public boolean push(BinlogTraceable e,
                    long timeout)
从接口 FountainMQ 复制的描述
push 一个消息,支持超时的版本,如果容量已满,此方法会堵塞直到容量被至少是否一个unit 或者超时,超时时返回false

指定者:
接口 FountainMQ 中的 push
参数:
e - 需要加入队列的元素
timeout - 单位ms
返回:
是否成功

pop

public BinlogTraceable pop()
从接口 FountainMQ 复制的描述
从队列中读取一个消息,如果队列中没有消息,则堵塞直到有一个消息进入

指定者:
接口 FountainMQ 中的 pop
返回:
消息数据

pop

public BinlogTraceable pop(long timeout)
从接口 FountainMQ 复制的描述
从队列中读取一个消息,支持超时版本,如果队列中没有消息,则堵塞直到有一个消息进入 或者超时,超时时返回false

指定者:
接口 FountainMQ 中的 pop
参数:
timeout - 单位ms
返回:
消息数据


Copyright © 2016 neoremind. All rights reserved.