Skip to content

Commit

Permalink
Improve the ThreadGroup of the Janitor
Browse files Browse the repository at this point in the history
  • Loading branch information
SalusaSecondus committed Feb 26, 2020
1 parent ba5f420 commit 5e9cfc5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
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

0 comments on commit 5e9cfc5

Please sign in to comment.