public class AsynchronousSubscriberBioImpl extends BigpipeSessionSupport implements AsynchronousSubscriber
使用nio实现时很难控制超时,当网络环境不好时会发生丢包现象,这将导致socket无法读取数据,但从程序 的角度来看socket又是健康的,socket会被永远堵塞导致线程不再工作。在uc client和fountain-das中都 遇到过这种问题,解决方案是设置读取超时,比如2分钟,如果超时则重新建立socket连接. 请使用bigPipeConf设置读取超时。
changelog by xiemalin 1. fix#extract(ByteBuffer, long[], MessageCommand[]) method should check bodySize <= buf.remaining()BigpipeSessionSupport.PIPE_TYPElifeController, pipeRuntime, reciever| 构造器和说明 |
|---|
AsynchronousSubscriberBioImpl() |
buildConnect, getPipeletOrQueueName, getType, init, setTypepublic Receiver getReciever()
public void setReciever(Receiver reciever)
public TransportStrategy getTransStrategy()
public void setTransStrategy(TransportStrategy transStrategy)
public BigpipeMessageListener getMessageListener()
public void setMessageListener(BigpipeMessageListener messageListener)
public MessageBodyConverter getBodyConverter()
public void setBodyConverter(MessageBodyConverter bodyConverter)
public SubcribePositionStore getPositionStore()
public void setPositionStore(SubcribePositionStore positionStore)
public void startSubscribe(BigpipeMessageListener listener, BigPipeConf conf)
AsynchronousSubscriberBigpipeMessageListener
进行消费startSubscribe 在接口中 AsynchronousSubscriberpublic void shutDown()
AsynchronousSubscribershutDown 在接口中 AsynchronousSubscriberprotected void continueConfig(BigPipeConf conf)
BigpipeSessionSupportBigPipeConf获取私有配置信息并应用continueConfig 在类中 BigpipeSessionSupportconf - BigPipeConf 配置信息public void start(BigPipeConf conf)
start 在类中 BigpipeSessionSupportconf - BigPipeConf 对象,配置信息protected void waitingForConnect(int cnt)
waitingForConnect 在类中 BigpipeSessionSupportcnt - 已经重试的次数protected SessionSocketStream openStream(InetAddress addr, SocketConf conf) throws IOException
BigpipeSessionSupportopenStream 在类中 BigpipeSessionSupportaddr - InetAddress地址conf - SocketConf网络相关配置SessionSocketStream 流IOException - 网络io异常protected TopicAddress lookupAddr(NameService ns, String pipeletName) throws NameResolveException, org.apache.zookeeper.KeeperException
BigpipeSessionSupportlookupAddr 在类中 BigpipeSessionSupportns - NameService对象pipeletName - pipelet Name or queue NameInetAddressNameResolveException - 根据名字解析TopicAddress QueueAddress异常org.apache.zookeeper.KeeperException - zk异常protected void handleFastFailed(boolean needBlocking)
BigpipeSessionSupporthandleFastFailed 在类中 BigpipeSessionSupportneedBlocking - 是否堵塞其他客户端操作,比如不能够再发布消息protected void safeCloseTcpConnect()
safeCloseTcpConnect 在类中 BigpipeSessionSupportCopyright © 2017. All rights reserved.