8347039: ThreadPerTaskExecutor terminates if cancelled tasks still running

Reviewed-by: vklang
This commit is contained in:
Alan Bateman 2025-01-15 10:54:03 +00:00
parent 91197b384f
commit af3f5d852e
2 changed files with 64 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -318,8 +318,12 @@ class ThreadPerTaskExecutor extends ThreadContainer implements ExecutorService {
}
@Override
protected void done() {
executor.taskComplete(thread);
public void run() {
try {
super.run();
} finally {
executor.taskComplete(thread);
}
}
}