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

Improve the ThreadGroup of the Janitor #87

Merged
merged 1 commit into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Maintenance
* Add timestamping to signed jars.
* Create the `Janitor` in the `Loader` so that it gets a more logical and consistent `ThreadGroup`.

## 1.3.0

Expand Down
5 changes: 5 additions & 0 deletions src/com/amazon/corretto/crypto/provider/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,16 @@ static String getProperty(String propertyName, String def) {
} else {
LOG.log(Level.CONFIG, "Unable to load native library", error);
}

// Finally start up a cleaning thread if necessary
RESOURCE_JANITOR = new Janitor();
}

static final boolean IS_AVAILABLE;
static final Throwable LOADING_ERROR;

static final Janitor RESOURCE_JANITOR;

static void load() {
// no-op - but we run the static block as a side effect
}
Expand Down
4 changes: 2 additions & 2 deletions src/com/amazon/corretto/crypto/provider/NativeResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

package com.amazon.corretto.crypto.provider;

import static com.amazon.corretto.crypto.provider.Loader.RESOURCE_JANITOR;

import java.util.concurrent.locks.ReentrantLock;
import java.util.function.LongConsumer;
import java.util.function.LongFunction;

class NativeResource {
private static final Janitor RESOURCE_JANITOR = new Janitor();

/**
* For tests. Makes a best-effort attempt to awaken any sleeping cleaner threads.
*/
Expand Down