OffsetStore原始碼分析

2021-10-05 18:26:58 字數 1175 閱讀 2970

offsetstore有兩種實現類,本地檔案和broker儲存兩種。 預設是集群模式下使用broker儲存,廣播模式下使用本地檔案。

從本地檔案恢復offset配置。

配置在檔案中以json形式存在。

@override

public

void

load()

throws mqclientexception {} {}"

,this

.groupname,

mq,offset.

get())

;}}}

updateoffset

更新記憶體中的offset

public

void

updateoffset

(messagequeue mq,

long offset,

boolean increaseonly)

if(null != offsetold)

else}}

}

把記憶體中每個佇列的offset存到檔案中

public

void

persistall

(set

mqs)

}tojson

(true);

if(jsonstring != null)

catch

(ioexception e)

}}

不需要載入

public

void

load()

public

void

updateconsumeoffsettobroker

(messagequeue mq,

long offset,

boolean isoneway)

throws remotingexception,

mqbrokerexception, interruptedexception, mqclientexception

if(findbrokerresult != null)

else

}else

}

Cartographer原始碼篇 原始碼分析 1

在安裝編譯cartographer 1.0.0的時候,我們可以看到 主要包括cartorgarpher ros cartographer ceres sover三個部分。其中,ceres solver用於非線性優化,求解最小二乘問題 cartographer ros為ros平台的封裝,獲取感測器資料...

AbstractListView原始碼分析3

normal list that does not indicate choices public static final int choice mode none 0 the list allows up to one choice public static final int choice ...

Android AsyncTask原始碼分析

android中只能在主線程中進行ui操作,如果是其它子執行緒,需要借助非同步訊息處理機制handler。除此之外,還有個非常方便的asynctask類,這個類內部封裝了handler和執行緒池。本文先簡要介紹asynctask的用法,然後分析具體實現。asynctask是乙個抽象類,我們需要建立子...