You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@rocketmq.apache.org by "vongosling (JIRA)" <ji...@apache.org> on 2016/12/30 03:26:58 UTC

[jira] [Work started] (ROCKETMQ-22) new funciton 'printWaterMark' in version 3.5.8(4.0.0) will cause a ClassCastException

     [ https://issues.apache.org/jira/browse/ROCKETMQ-22?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on ROCKETMQ-22 started by vongosling.
------------------------------------------
> 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: vongosling
>            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)