[
https://issues.apache.org/jira/browse/ROCKETMQ-22?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15811841#comment-15811841
]
ASF subversion and git services commented on ROCKETMQ-22:
---------------------------------------------------------
Commit 6e31d864e3f49b1296bad2e24955bee4d918d31d in incubator-rocketmq's branch
refs/heads/master from [~Yukon]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-rocketmq.git;h=6e31d86 ]
[ROCKETMQ-22] Resolve ClassCastException issue in printWaterMark.
> new funciton 'printWaterMark' in version 3.5.8(4.0.0) will cause a
> ClassCastException
> -------------------------------------------------------------------------------------
>
> Key: ROCKETMQ-22
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-22
> Project: Apache RocketMQ
> Issue Type: Bug
> Components: rocketmq-broker
> Affects Versions: 4.0.0-incubating
> Reporter: libin
> Assignee: yukon
> Priority: Minor
>
> ew funciton 'printWaterMark' in version 3.5.8(4.0.0) will cause a
> ClassCastException;
> printWaterMark.headSlowTimeMills4PullThreadPoolQueue.headSlowTimeMills
> {quote}
> public long headSlowTimeMills(BlockingQueue<Runnable> q) {
> long slowTimeMills = 0;
> final Runnable peek = q.peek();
> if (peek != null) {
> {color:red}
> RequestTask rt = BrokerFastFailure.castRunnable(peek);
> {color}
> slowTimeMills = this.messageStore.now() - rt.getCreateTimestamp();
> }
> if (slowTimeMills < 0) slowTimeMills = 0;
> return slowTimeMills;
> }
> {quote}
> in BrokerFastFailure.castRunnable, it will cast runnable to {color:red}
> RequestTask {color}
> {quote}
> public static RequestTask castRunnable(final Runnable runnable) {
> try {
> FutureTaskExt object = (FutureTaskExt) runnable;
> {color:red}
> return (RequestTask) object.getRunnable();{color}
> ...
> }
> return null;
> }
> {quote}
> but in a specail condition, it don't submit a RequestTask, so cause a
> ClassCastException
> {quote}
>
> this.brokerController.getPullMessageProcessor().excuteRequestWhenWakeup(request.getClientChannel(),
> request.getRequestCommand());
>
> public void excuteRequestWhenWakeup(final Channel channel, final
> RemotingCommand request) throws RemotingCommandException {
> {color:red}
> Runnable run = new Runnable() {
> {color}
> @Override
> public void run() {
> try {
> final RemotingCommand response =
> PullMessageProcessor.this.processRequest(channel, request, false);
> ....
> {color:red}
> this.brokerController.getPullMessageExecutor().submit(run);
> {color}
> }
> {quote}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)