Skip to content

Commit

Permalink
根据Findbugs修复所有发现的问题。
Browse files Browse the repository at this point in the history
  • Loading branch information
vintagewang committed Jan 23, 2014
1 parent 1173883 commit 9f1d849
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public List<String> getAllClientId() {


public void unregisterChannel(final ClientChannelInfo clientChannelInfo) {
ClientChannelInfo old = this.channelInfoTable.remove(clientChannelInfo.getChannel().hashCode());
ClientChannelInfo old = this.channelInfoTable.remove(clientChannelInfo.getChannel());
if (old != null) {
log.info("unregister a consumer[{}] from consumerGroupInfo {}", this.groupName, old.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ private RemotingCommand consumerSendMsgBack(final ChannelHandlerContext ctx, fin
}

String newTopic = MixAll.getRetryTopic(requestHeader.getGroup());
int queueIdInt = Math.abs(this.random.nextInt()) % subscriptionGroupConfig.getRetryQueueNums();
int queueIdInt =
Math.abs(this.random.nextInt() % 99999999) % subscriptionGroupConfig.getRetryQueueNums();

// 检查topic是否存在
TopicConfig topicConfig =
Expand Down Expand Up @@ -165,7 +166,7 @@ private RemotingCommand consumerSendMsgBack(final ChannelHandlerContext ctx, fin
if (msgExt.getReconsumeTimes() >= subscriptionGroupConfig.getRetryMaxTimes()//
|| delayLevel < 0) {
newTopic = MixAll.getDLQTopic(requestHeader.getGroup());
queueIdInt = Math.abs(this.random.nextInt()) % DLQ_NUMS_PER_GROUP;
queueIdInt = Math.abs(this.random.nextInt() % 99999999) % DLQ_NUMS_PER_GROUP;

topicConfig =
this.brokerController.getTopicConfigManager().createTopicInSendMessageBackMethod(
Expand Down Expand Up @@ -326,7 +327,7 @@ private RemotingCommand sendMessage(final ChannelHandlerContext ctx, final Remot

// 随机指定一个队列
if (queueIdInt < 0) {
queueIdInt = Math.abs(this.random.nextInt()) % topicConfig.getWriteQueueNums();
queueIdInt = Math.abs(this.random.nextInt() % 99999999) % topicConfig.getWriteQueueNums();
}

int sysFlag = requestHeader.getSysFlag();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc
private static int initValueIndex() {
Random r = new Random();

return Math.abs(r.nextInt()) % 999;
return Math.abs(r.nextInt() % 999) % 999;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ private static String diskUtil() {


public static void main(String[] args) {
int a = -25;
int b = 1;

int c = a % b;
System.out.println(c);

System.out.println(diskUtil());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,10 @@ public void run() {
log.warn("Unexpected ops in select " + k.readyOps());
}
}

selected.clear();
}

selected.clear();
}
catch (Exception e) {
log.error(this.getServiceName() + " service has exception.", e);
Expand Down

0 comments on commit 9f1d849

Please sign in to comment.