com.taobao.metamorphosis.client.extension.producer
类 LocalMessageStorageManager

java.lang.Object
  继承者 com.taobao.metamorphosis.client.extension.producer.LocalMessageStorageManager
所有已实现的接口:
MessageRecoverManager, Shutdownable
直接已知子类:
OrderedLocalMessageStorageManager

public class LocalMessageStorageManager
extends Object
implements MessageRecoverManager

消息缓存在本地磁盘,并定期或手动recover

从以下版本开始:
2011-8-8 上午10:40:56
作者:
无花

嵌套类摘要
 
从接口 com.taobao.metamorphosis.client.extension.producer.MessageRecoverManager 继承的嵌套类/接口
MessageRecoverManager.MessageRecoverer
 
字段摘要
static String DEFAULT_META_LOCALMESSAGE_PATH
           
protected  Deserializer deserializer
           
protected  MessageRecoverManager.MessageRecoverer messageRecoverer
           
 String META_LOCALMESSAGE_PATH
           
protected static String SPLIT
           
protected  ThreadPoolExecutor threadPoolExecutor
           
protected  ConcurrentHashMap<String,FutureTask<Boolean>> topicRecoverTaskMap
          表示正在执行的恢复任务的map
protected  ConcurrentHashMap<String,FutureTask<Store>> topicStoreMap
          表示以topic@partition为单位的store map
 
构造方法摘要
LocalMessageStorageManager(MetaClientConfig metaClientConfig)
           
LocalMessageStorageManager(MetaClientConfig metaClientConfig, String path, MessageRecoverManager.MessageRecoverer messageRecoverer)
           
 
方法摘要
 void append(Message message, Partition partition)
          存入消息
protected  String generateKey(String topic, Partition partition)
           
 int getMessageCount(String topic, Partition partition)
          消息条数
protected  Store getOrCreateStore(String topic, Partition partition)
           
protected  Store newStore(String name)
           
 void recover()
          全部恢复
 boolean recover(String topic, Partition partition, MessageRecoverManager.MessageRecoverer recoverer)
          触发恢复一个主题一个分区的消息,可多次调用(保证对某主题的恢复任务最多只有一个在运行)
 void setMessageRecoverer(MessageRecoverManager.MessageRecoverer recoverer)
          设置如何恢复消息的处理器
 void shutdown()
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

SPLIT

protected static final String SPLIT
另请参见:
常量字段值

topicStoreMap

protected final ConcurrentHashMap<String,FutureTask<Store>> topicStoreMap
表示以topic@partition为单位的store map


topicRecoverTaskMap

protected final ConcurrentHashMap<String,FutureTask<Boolean>> topicRecoverTaskMap
表示正在执行的恢复任务的map


deserializer

protected final Deserializer deserializer

DEFAULT_META_LOCALMESSAGE_PATH

public static final String DEFAULT_META_LOCALMESSAGE_PATH

META_LOCALMESSAGE_PATH

public String META_LOCALMESSAGE_PATH

threadPoolExecutor

protected final ThreadPoolExecutor threadPoolExecutor

messageRecoverer

protected MessageRecoverManager.MessageRecoverer messageRecoverer
构造方法详细信息

LocalMessageStorageManager

public LocalMessageStorageManager(MetaClientConfig metaClientConfig)

LocalMessageStorageManager

public LocalMessageStorageManager(MetaClientConfig metaClientConfig,
                                  String path,
                                  MessageRecoverManager.MessageRecoverer messageRecoverer)
方法详细信息

recover

public void recover()
从接口 MessageRecoverManager 复制的描述
全部恢复

指定者:
接口 MessageRecoverManager 中的 recover

recover

public boolean recover(String topic,
                       Partition partition,
                       MessageRecoverManager.MessageRecoverer recoverer)
触发恢复一个主题一个分区的消息,可多次调用(保证对某主题的恢复任务最多只有一个在运行)

指定者:
接口 MessageRecoverManager 中的 recover
参数:
topic -
partition -
recoverer - 恢复出来的消息的处理器
返回:
是否真正提交了恢复任务

getOrCreateStore

protected Store getOrCreateStore(String topic,
                                 Partition partition)

shutdown

public void shutdown()
指定者:
接口 Shutdownable 中的 shutdown

append

public void append(Message message,
                   Partition partition)
            throws IOException
从接口 MessageRecoverManager 复制的描述
存入消息

指定者:
接口 MessageRecoverManager 中的 append
抛出:
IOException

getMessageCount

public int getMessageCount(String topic,
                           Partition partition)
从接口 MessageRecoverManager 复制的描述
消息条数

指定者:
接口 MessageRecoverManager 中的 getMessageCount
返回:

generateKey

protected String generateKey(String topic,
                             Partition partition)

setMessageRecoverer

public void setMessageRecoverer(MessageRecoverManager.MessageRecoverer recoverer)
从接口 MessageRecoverManager 复制的描述
设置如何恢复消息的处理器

指定者:
接口 MessageRecoverManager 中的 setMessageRecoverer

newStore

protected Store newStore(String name)
                  throws IOException
抛出:
IOException


Copyright © 2010–2013. All rights reserved.