Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shutdown() function for CleanerThread #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jjYBdx4IL
Copy link

proper fix for:

https://issues.apache.org/jira/browse/BATIK-939

instead of using or suppressing interrupts, a simple CountDownLatch is used to check whether the thread should shut down or not.

try {
ref = queue.remove();
try {
while(!shutdownLatch.await(100, TimeUnit.MILLISECONDS)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a reasoning as to why 100ms?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not against a timeout, but 100ms looks way too small.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to seconds.

@jjYBdx4IL
Copy link
Author

Not really.

throw td;
} catch (Throwable t) {
t.printStackTrace();
} finally {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should release the hatch at the finally block, before setting queue to null:

    shutdownLatch.countDown();

@carlosame
Copy link

@jjYBdx4IL I see that you modified the pull request after my comments, just wanted to point out that I'm not a Batik developer nor am I related to the ASF in any way.

Thus, my comments do not represent any "official" statement from the Batik developers, the PMC nor the ASF.

@jjYBdx4IL jjYBdx4IL force-pushed the CleanerThreadInterrupt branch 2 times, most recently from 8ac91be to e0f777e Compare June 11, 2021 22:34
* de-initialize CleanerThread variables on thread shutdown
* don't run CleanerThread as daemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants