libin created ROCKETMQ-22:
-----------------------------

             Summary: new funciton 'printWaterMark' in version 3.5.8 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)

Reply via email to