[
https://issues.apache.org/jira/browse/CASSANDRA-455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12759728#action_12759728
]
Jonathan Ellis commented on CASSANDRA-455:
------------------------------------------
Okay, here's what's going on.
ScheduledFutureTask overrides FT.run as follows:
public void run() {
if (isPeriodic())
runPeriodic();
else
ScheduledFutureTask.super.run();
}
we are scheduling periodic tasks, so the normal run() method, which just wrapps
sync.innerRun(), is not called. Instead we call runPeriodic, of which the
important part here is
boolean ok = ScheduledFutureTask.super.runAndReset();
not run()! runAndReset()! which says
/**
* Executes the computation without setting its result, and then
* resets this Future to initial state, failing to do so if the
* computation encounters an exception or is cancelled. This is
* designed for use with tasks that intrinsically execute more
* than once.
* @return true if successfully run and reset
*/
protected boolean runAndReset() {
return sync.innerRunAndReset();
}
key point is "... without setting its result." sure enough, sync.innerRAR sets
the state back to 0 when it is done -- but get() will block until state is RAN
or CANCELLED, i.e. until there is a result. So the reason get() makes the task
stop executing is it deadlocks the executor thread that it's running on.
as far as i can see there is no public way to get an exception out of a
FutureTask.sync w/o calling get. I guess we can get it out using reflection
tho.
For 0.4 I will just revert the commit that added logFutureExceptions to
DebuggableScheduledThreadPoolExecutor.
> DebuggableScheduledThreadPoolExecutor only schedules a task once
> ----------------------------------------------------------------
>
> Key: CASSANDRA-455
> URL: https://issues.apache.org/jira/browse/CASSANDRA-455
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.4, 0.5
> Reporter: Jun Rao
> Fix For: 0.5
>
>
> DebuggableScheduledThreadPoolExecutor only schedules a task exactly once,
> instead of periodically. This affects scheduled flushers and periodic hints
> delivery.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.