本文整理汇总了Java中com.alibaba.rocketmq.common.protocol.body.TopicList.encode方法的典型用法代码示例。如果您正苦于以下问题:Java TopicList.encode方法的具体用法?Java TopicList.encode怎么用?Java TopicList.encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.rocketmq.common.protocol.body.TopicList
的用法示例。
在下文中一共展示了TopicList.encode方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllTopicList
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
public byte[] getAllTopicList() {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
topicList.getTopicList().addAll(this.topicQueueTable.keySet());
}
finally {
this.lock.readLock().unlock();
}
}
catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}
示例2: getUnitTopics
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
public byte[] getUnitTopics() {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
Iterator<Entry<String, List<QueueData>>> topicTableIt =
this.topicQueueTable.entrySet().iterator();
while (topicTableIt.hasNext()) {
Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
String topic = topicEntry.getKey();
List<QueueData> queueDatas = topicEntry.getValue();
if (queueDatas != null && queueDatas.size() > 0
&& TopicSysFlag.hasUnitFlag(queueDatas.get(0).getTopicSynFlag())) {
topicList.getTopicList().add(topic);
}
}
} finally {
this.lock.readLock().unlock();
}
} catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}
示例3: getHasUnitSubTopicList
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
public byte[] getHasUnitSubTopicList() {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
Iterator<Entry<String, List<QueueData>>> topicTableIt =
this.topicQueueTable.entrySet().iterator();
while (topicTableIt.hasNext()) {
Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
String topic = topicEntry.getKey();
List<QueueData> queueDatas = topicEntry.getValue();
if (queueDatas != null && queueDatas.size() > 0
&& TopicSysFlag.hasUnitSubFlag(queueDatas.get(0).getTopicSynFlag())) {
topicList.getTopicList().add(topic);
}
}
} finally {
this.lock.readLock().unlock();
}
} catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}
示例4: getHasUnitSubUnUnitTopicList
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
public byte[] getHasUnitSubUnUnitTopicList() {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
Iterator<Entry<String, List<QueueData>>> topicTableIt =
this.topicQueueTable.entrySet().iterator();
while (topicTableIt.hasNext()) {
Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
String topic = topicEntry.getKey();
List<QueueData> queueDatas = topicEntry.getValue();
if (queueDatas != null && queueDatas.size() > 0
&& !TopicSysFlag.hasUnitFlag(queueDatas.get(0).getTopicSynFlag())
&& TopicSysFlag.hasUnitSubFlag(queueDatas.get(0).getTopicSynFlag())) {
topicList.getTopicList().add(topic);
}
}
} finally {
this.lock.readLock().unlock();
}
} catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}
示例5: getSystemTopicList
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
public byte[] getSystemTopicList() {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
for (String cluster : clusterAddrTable.keySet()) {
topicList.getTopicList().add(cluster);
topicList.getTopicList().addAll(this.clusterAddrTable.get(cluster));
}
if (brokerAddrTable != null && !brokerAddrTable.isEmpty()) {
Iterator<String> it = brokerAddrTable.keySet().iterator();
while (it.hasNext()) {
BrokerData bd = brokerAddrTable.get(it.next());
HashMap<Long, String> brokerAddrs = bd.getBrokerAddrs();
if (bd.getBrokerAddrs() != null && !bd.getBrokerAddrs().isEmpty()) {
Iterator<Long> it2 = brokerAddrs.keySet().iterator();
topicList.setBrokerAddr(brokerAddrs.get(it2.next()));
break;
}
}
}
}
finally {
this.lock.readLock().unlock();
}
}
catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}
示例6: getTopicsByCluster
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
public byte[] getTopicsByCluster(String cluster) {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
Set<String> brokerNameSet = this.clusterAddrTable.get(cluster);
for (String brokerName : brokerNameSet) {
Iterator<Entry<String, List<QueueData>>> topicTableIt =
this.topicQueueTable.entrySet().iterator();
while (topicTableIt.hasNext()) {
Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
String topic = topicEntry.getKey();
List<QueueData> queueDatas = topicEntry.getValue();
for (QueueData queueData : queueDatas) {
if (brokerName.equals(queueData.getBrokerName())) {
topicList.getTopicList().add(topic);
break;
}
}
}
}
}
finally {
this.lock.readLock().unlock();
}
}
catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}
示例7: getUnitTopics
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
public byte[] getUnitTopics() {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
Iterator<Entry<String, List<QueueData>>> topicTableIt =
this.topicQueueTable.entrySet().iterator();
while (topicTableIt.hasNext()) {
Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
String topic = topicEntry.getKey();
List<QueueData> queueDatas = topicEntry.getValue();
if (queueDatas != null && queueDatas.size() > 0
&& TopicSysFlag.hasUnitFlag(queueDatas.get(0).getTopicSynFlag())) {
topicList.getTopicList().add(topic);
}
}
}
finally {
this.lock.readLock().unlock();
}
}
catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}
示例8: getHasUnitSubTopicList
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
public byte[] getHasUnitSubTopicList() {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
Iterator<Entry<String, List<QueueData>>> topicTableIt =
this.topicQueueTable.entrySet().iterator();
while (topicTableIt.hasNext()) {
Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
String topic = topicEntry.getKey();
List<QueueData> queueDatas = topicEntry.getValue();
if (queueDatas != null && queueDatas.size() > 0
&& TopicSysFlag.hasUnitSubFlag(queueDatas.get(0).getTopicSynFlag())) {
topicList.getTopicList().add(topic);
}
}
}
finally {
this.lock.readLock().unlock();
}
}
catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}
示例9: getHasUnitSubUnUnitTopicList
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
public byte[] getHasUnitSubUnUnitTopicList() {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
Iterator<Entry<String, List<QueueData>>> topicTableIt =
this.topicQueueTable.entrySet().iterator();
while (topicTableIt.hasNext()) {
Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
String topic = topicEntry.getKey();
List<QueueData> queueDatas = topicEntry.getValue();
if (queueDatas != null && queueDatas.size() > 0
&& !TopicSysFlag.hasUnitFlag(queueDatas.get(0).getTopicSynFlag())
&& TopicSysFlag.hasUnitSubFlag(queueDatas.get(0).getTopicSynFlag())) {
topicList.getTopicList().add(topic);
}
}
}
finally {
this.lock.readLock().unlock();
}
}
catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}
示例10: getAllTopicList
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
public byte[] getAllTopicList() {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
topicList.getTopicList().addAll(this.topicQueueTable.keySet());
} finally {
this.lock.readLock().unlock();
}
} catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}
示例11: getSystemTopicList
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
public byte[] getSystemTopicList() {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
for (String cluster : clusterAddrTable.keySet()) {
topicList.getTopicList().add(cluster);
topicList.getTopicList().addAll(this.clusterAddrTable.get(cluster));
}
if (brokerAddrTable != null && !brokerAddrTable.isEmpty()) {
Iterator<String> it = brokerAddrTable.keySet().iterator();
while (it.hasNext()) {
BrokerData bd = brokerAddrTable.get(it.next());
HashMap<Long, String> brokerAddrs = bd.getBrokerAddrs();
if (bd.getBrokerAddrs() != null && !bd.getBrokerAddrs().isEmpty()) {
Iterator<Long> it2 = brokerAddrs.keySet().iterator();
topicList.setBrokerAddr(brokerAddrs.get(it2.next()));
break;
}
}
}
} finally {
this.lock.readLock().unlock();
}
} catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}
示例12: getTopicsByCluster
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
/**
* 获取集群下的Topic
* Topic:BrokerName = 1:n
* 所以需要先根据cluster查找到brokerName
*
* @param cluster
* @return
*/
public byte[] getTopicsByCluster(String cluster) {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
Set<String> brokerNameSet = this.clusterAddrTable.get(cluster);
for (String brokerName : brokerNameSet) {
Iterator<Entry<String, List<QueueData>>> topicTableIt =
this.topicQueueTable.entrySet().iterator();
while (topicTableIt.hasNext()) {
Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
String topic = topicEntry.getKey();
List<QueueData> queueDatas = topicEntry.getValue();
for (QueueData queueData : queueDatas) {
if (brokerName.equals(queueData.getBrokerName())) {
topicList.getTopicList().add(topic);
break;
}
}
}
}
} finally {
this.lock.readLock().unlock();
}
} catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}
示例13: getTopicsByCluster
import com.alibaba.rocketmq.common.protocol.body.TopicList; //导入方法依赖的package包/类
/**
* 获取指定集群下的所有 topic 列表
*
* @param cluster
* @return
*/
public byte[] getTopicsByCluster(String cluster) {
TopicList topicList = new TopicList();
try {
try {
this.lock.readLock().lockInterruptibly();
Set<String> brokerNameSet = this.clusterAddrTable.get(cluster);
for (String brokerName : brokerNameSet) {
Iterator<Entry<String, List<QueueData>>> topicTableIt =
this.topicQueueTable.entrySet().iterator();
while (topicTableIt.hasNext()) {
Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
String topic = topicEntry.getKey();
List<QueueData> queueDatas = topicEntry.getValue();
for (QueueData queueData : queueDatas) {
if (brokerName.equals(queueData.getBrokerName())) {
topicList.getTopicList().add(topic);
break;
}
}
}
}
}
finally {
this.lock.readLock().unlock();
}
}
catch (Exception e) {
log.error("getAllTopicList Exception", e);
}
return topicList.encode();
}