Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizzercn committed Aug 1, 2018
1 parent 0e9ee44 commit 9da5a5c
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ public class MessageIdService implements IMessageIdService {
@Inject
private RedisService redisService;

private int nextMsgId = 0;

@Override
public int getNextMessageId() {
try {
nextMsgId = (int) (redisService.incr("mqttwk:messageid:num") % 65536);
int nextMsgId = (int) (redisService.incr("mqttwk:messageid:num") % 65536);
if (nextMsgId == 0)
return this.getNextMessageId();
return nextMsgId;
} catch (Exception e) {
e.printStackTrace();
}
return nextMsgId;
return 0;
}

/**
Expand Down

0 comments on commit 9da5a5c

Please sign in to comment.