[
https://issues.apache.org/jira/browse/HBASE-25024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17195315#comment-17195315
]
Reid Chan commented on HBASE-25024:
-----------------------------------
One more arguable point:
{code}
for (int i = 0; i < nbThread / 2; i++) {
if (threads.get(i).getState().equals(Thread.State.TERMINATED)) {
expectedNoExNum--;
}
threads.get(i).interrupt();
}
{code}
It only interrupts the first half, not actually random 50%. I tried this
version which failed more often:
{code}
for (int i = 0; i < nbThread; i += 2) {
if (threads.get(i).getState().equals(Thread.State.TERMINATED)) {
expectedNoExNum--;
}
threads.get(i).interrupt();
}
{code}
So this test is really too tricky...
Step back, I'm not sure why this test has to achieve 50% interrupted.
> [Flake Test][branch-1] TestClientOperationInterrupt#testInterrupt50Percent
> --------------------------------------------------------------------------
>
> Key: HBASE-25024
> URL: https://issues.apache.org/jira/browse/HBASE-25024
> Project: HBase
> Issue Type: Improvement
> Reporter: Reid Chan
> Priority: Minor
> Fix For: 1.7.0
>
>
> Sometimes threads could finish faster before interrupt() gets called.
> {code}
> // ...
> t.start();
> }
> int expectedNoExNum = nbThread / 2;
> for (int i = 0; i < nbThread / 2; i++) {
> if (threads.get(i).getState().equals(Thread.State.TERMINATED)) {
> expectedNoExNum--;
> }
> threads.get(i).interrupt();
> }
> {code}
> So this test could get failed sometimes.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)