Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
4.0.0-incubating
-
None
Description
ew funciton 'printWaterMark' in version 3.5.8(4.0.0) will cause a ClassCastException;
printWaterMark.headSlowTimeMills4PullThreadPoolQueue.headSlowTimeMills
public long headSlowTimeMills(BlockingQueue<Runnable> q) {
long slowTimeMills = 0;
final Runnable peek = q.peek();
if (peek != null) {
RequestTask rt = BrokerFastFailure.castRunnable(peek);
slowTimeMills = this.messageStore.now() - rt.getCreateTimestamp();
}if (slowTimeMills < 0) slowTimeMills = 0;
return slowTimeMills;
}
in BrokerFastFailure.castRunnable, it will cast runnable to RequestTask
public static RequestTask castRunnable(final Runnable runnable) {
try {
FutureTaskExt object = (FutureTaskExt) runnable;
return (RequestTask) object.getRunnable();
...
}return null;
}
but in a specail condition, it don't submit a RequestTask, so cause a ClassCastException
this.brokerController.getPullMessageProcessor().excuteRequestWhenWakeup(request.getClientChannel(), request.getRequestCommand());
public void excuteRequestWhenWakeup(final Channel channel, final RemotingCommand request) throws RemotingCommandException {
Runnable run = new Runnable() {
@Override
public void run() {
try {
final RemotingCommand response = PullMessageProcessor.this.processRequest(channel, request, false);
....
this.brokerController.getPullMessageExecutor().submit(run);
}