diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index de88ba99..84bceb8b 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@8b5e8b768746b50394015010d25e690bfab9dfbc + - uses: actions/checkout@72f2cec99f417b1a1c5e2e88945068983b7965f9 - name: Set up JDK 8 uses: actions/setup-java@4075bfc1b51bf22876335ae1cd589602d60d8758 with: @@ -32,7 +32,7 @@ jobs: server-password: ${{ secrets.OSSRH_PASSWORD }} - name: Cache local Maven repository - uses: actions/cache@f7ebb81a3f195b4fb88dab7c14e2f7aff52045aa + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -49,7 +49,7 @@ jobs: run: mvn --batch-mode --update-snapshots verify - name: Upload coverage to Codecov - uses: codecov/codecov-action@04adcebd9b38cae0bb0fd4a05e3497ce0bce41a0 + uses: codecov/codecov-action@398b9de041a7e69750d45077b10c5912201a3466 with: token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos flags: unittests # optional diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 3173d904..8b018bdb 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the code - uses: actions/checkout@8b5e8b768746b50394015010d25e690bfab9dfbc + uses: actions/checkout@72f2cec99f417b1a1c5e2e88945068983b7965f9 - name: Set up JDK 8 uses: actions/setup-java@4075bfc1b51bf22876335ae1cd589602d60d8758 @@ -20,12 +20,12 @@ jobs: cache: maven - name: Initialize CodeQL - uses: github/codeql-action/init@07d42ec34e55d7e17f411bffdf54e254effd68ae + uses: github/codeql-action/init@43750fe4fc4f068f04f2215206e6f6a29c78c763 with: languages: java - name: Cache local Maven repository - uses: actions/cache@f7ebb81a3f195b4fb88dab7c14e2f7aff52045aa + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -36,7 +36,7 @@ jobs: run: mvn --batch-mode --update-snapshots --activate-profiles e2e verify - name: Upload coverage to Codecov - uses: codecov/codecov-action@04adcebd9b38cae0bb0fd4a05e3497ce0bce41a0 + uses: codecov/codecov-action@398b9de041a7e69750d45077b10c5912201a3466 with: token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos flags: unittests # optional @@ -45,4 +45,4 @@ jobs: verbose: true # optional (default = false) - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@07d42ec34e55d7e17f411bffdf54e254effd68ae + uses: github/codeql-action/analyze@43750fe4fc4f068f04f2215206e6f6a29c78c763 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d433b047..90f5d59c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: # These steps are only run if this was a merged release-please PR - name: checkout if: ${{ steps.release.outputs.releases_created }} - uses: actions/checkout@8b5e8b768746b50394015010d25e690bfab9dfbc + uses: actions/checkout@72f2cec99f417b1a1c5e2e88945068983b7965f9 - name: Set up JDK 8 if: ${{ steps.release.outputs.releases_created }} uses: actions/setup-java@4075bfc1b51bf22876335ae1cd589602d60d8758 diff --git a/.github/workflows/static-code-scanning.yaml b/.github/workflows/static-code-scanning.yaml index f5558e99..1190722f 100644 --- a/.github/workflows/static-code-scanning.yaml +++ b/.github/workflows/static-code-scanning.yaml @@ -29,16 +29,16 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@8b5e8b768746b50394015010d25e690bfab9dfbc + uses: actions/checkout@72f2cec99f417b1a1c5e2e88945068983b7965f9 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@07d42ec34e55d7e17f411bffdf54e254effd68ae + uses: github/codeql-action/init@43750fe4fc4f068f04f2215206e6f6a29c78c763 with: languages: java - name: Autobuild - uses: github/codeql-action/autobuild@07d42ec34e55d7e17f411bffdf54e254effd68ae + uses: github/codeql-action/autobuild@43750fe4fc4f068f04f2215206e6f6a29c78c763 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@07d42ec34e55d7e17f411bffdf54e254effd68ae + uses: github/codeql-action/analyze@43750fe4fc4f068f04f2215206e6f6a29c78c763 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4a8b7113..f1ef058b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1 +1 @@ -{".":"1.6.0"} \ No newline at end of file +{".":"1.6.1"} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bb5e01d2..f1571c6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## [1.6.1](https://github.com/open-feature/java-sdk/compare/v1.6.0...v1.6.1) (2023-09-09) + + +### ๐Ÿ› Bug Fixes + +* **deps:** update dependency io.cucumber:cucumber-bom to v7.14.0 ([#602](https://github.com/open-feature/java-sdk/issues/602)) ([5fd86b6](https://github.com/open-feature/java-sdk/commit/5fd86b6444667085e2697a08a1a34733fcb2a368)) +* make executor threads deamon ([#601](https://github.com/open-feature/java-sdk/issues/601)) ([c66b995](https://github.com/open-feature/java-sdk/commit/c66b99579f8a199c051d249caad59bbc5b8915f6)) +* NPE on named provider init/shutdown ([#595](https://github.com/open-feature/java-sdk/issues/595)) ([d063bf2](https://github.com/open-feature/java-sdk/commit/d063bf292cb79d0499b266b7eb9fa2b627f96444)) + + +### ๐Ÿงน Chore + +* **deps:** update actions/cache digest to 704facf ([#596](https://github.com/open-feature/java-sdk/issues/596)) ([4c686c9](https://github.com/open-feature/java-sdk/commit/4c686c9623a7d631a0a3b5394211174a11204b47)) +* **deps:** update actions/checkout digest to 3df4ab1 ([#587](https://github.com/open-feature/java-sdk/issues/587)) ([742ad0b](https://github.com/open-feature/java-sdk/commit/742ad0bc174d3fffbc1b4a819528f3ddac03e4c0)) +* **deps:** update actions/checkout digest to 72f2cec ([#589](https://github.com/open-feature/java-sdk/issues/589)) ([1aea784](https://github.com/open-feature/java-sdk/commit/1aea7843baf8737ded5cb625b59998b9d6916717)) +* **deps:** update codecov/codecov-action digest to 398b9de ([#598](https://github.com/open-feature/java-sdk/issues/598)) ([c2d2e0d](https://github.com/open-feature/java-sdk/commit/c2d2e0dedd339de34217fa755f1cf7f94302a2c7)) +* **deps:** update codecov/codecov-action digest to 7811627 ([#591](https://github.com/open-feature/java-sdk/issues/591)) ([1ad0129](https://github.com/open-feature/java-sdk/commit/1ad0129a7972c5bf73257a6789a68e34849668ce)) +* **deps:** update codecov/codecov-action digest to a08d532 ([#593](https://github.com/open-feature/java-sdk/issues/593)) ([a2e4894](https://github.com/open-feature/java-sdk/commit/a2e48948075cb6051a0ce719dc08fa0878d2869c)) +* **deps:** update github/codeql-action digest to 43750fe ([#597](https://github.com/open-feature/java-sdk/issues/597)) ([68f97c6](https://github.com/open-feature/java-sdk/commit/68f97c6c08a1223ad49e5358cadc3dab66a1d9ec)) +* **deps:** update github/codeql-action digest to 4764dce ([#594](https://github.com/open-feature/java-sdk/issues/594)) ([1441c2c](https://github.com/open-feature/java-sdk/commit/1441c2c12e9980a52cf33d60a89810a4b0ee8c8a)) +* **deps:** update github/codeql-action digest to 798e74c ([#590](https://github.com/open-feature/java-sdk/issues/590)) ([2763c8f](https://github.com/open-feature/java-sdk/commit/2763c8f7a6fb5f200574612cba160afa61481e60)) + ## [1.6.0](https://github.com/open-feature/java-sdk/compare/v1.5.0...v1.6.0) (2023-09-03) diff --git a/README.md b/README.md index 6f3afdfd..ca9626f6 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ - - Release + + Release @@ -59,7 +59,7 @@ Note that this library is intended to be used in server-side contexts and has no dev.openfeature sdk - 1.6.0 + 1.6.1 ``` @@ -84,7 +84,7 @@ If you would like snapshot builds, this is the relevant repository information: ```groovy dependencies { - implementation 'dev.openfeature:sdk:1.6.0' + implementation 'dev.openfeature:sdk:1.6.1' } ``` diff --git a/pom.xml b/pom.xml index 56375a74..5d9800dd 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ dev.openfeature sdk - 1.6.0 + 1.6.1 UTF-8 @@ -154,7 +154,7 @@ io.cucumber cucumber-bom - 7.13.0 + 7.14.0 pom import diff --git a/src/main/java/dev/openfeature/sdk/EventSupport.java b/src/main/java/dev/openfeature/sdk/EventSupport.java index 7620c3f8..7f616554 100644 --- a/src/main/java/dev/openfeature/sdk/EventSupport.java +++ b/src/main/java/dev/openfeature/sdk/EventSupport.java @@ -1,5 +1,8 @@ package dev.openfeature.sdk; +import lombok.extern.slf4j.Slf4j; + +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -11,9 +14,6 @@ import java.util.concurrent.Executors; import java.util.function.Consumer; -import edu.umd.cs.findbugs.annotations.Nullable; -import lombok.extern.slf4j.Slf4j; - /** * Util class for storing and running handlers. */ @@ -23,9 +23,13 @@ class EventSupport { // we use a v4 uuid as a "placeholder" for anonymous clients, since // ConcurrentHashMap doesn't support nulls private static final String defaultClientUuid = UUID.randomUUID().toString(); - private final ExecutorService taskExecutor = Executors.newCachedThreadPool(); private final Map handlerStores = new ConcurrentHashMap<>(); private final HandlerStore globalHandlerStore = new HandlerStore(); + private final ExecutorService taskExecutor = Executors.newCachedThreadPool(runnable -> { + final Thread thread = new Thread(runnable); + thread.setDaemon(true); + return thread; + }); /** * Run all the event handlers associated with this client name. diff --git a/src/main/java/dev/openfeature/sdk/ProviderRepository.java b/src/main/java/dev/openfeature/sdk/ProviderRepository.java index b7d57049..f3967e26 100644 --- a/src/main/java/dev/openfeature/sdk/ProviderRepository.java +++ b/src/main/java/dev/openfeature/sdk/ProviderRepository.java @@ -22,7 +22,11 @@ class ProviderRepository { private final Map providers = new ConcurrentHashMap<>(); private final AtomicReference defaultProvider = new AtomicReference<>(new NoOpProvider()); - private final ExecutorService taskExecutor = Executors.newCachedThreadPool(); + private final ExecutorService taskExecutor = Executors.newCachedThreadPool(runnable -> { + final Thread thread = new Thread(runnable); + thread.setDaemon(true); + return thread; + }); /** * Return the default provider. @@ -135,14 +139,15 @@ private void initializeProvider(FeatureProvider newProvider, } private void shutDownOld(FeatureProvider oldProvider,Consumer afterShutdown) { - if (!isProviderRegistered(oldProvider)) { + if (oldProvider != null && !isProviderRegistered(oldProvider)) { shutdownProvider(oldProvider); afterShutdown.accept(oldProvider); } } private boolean isProviderRegistered(FeatureProvider oldProvider) { - return this.providers.containsValue(oldProvider) || this.defaultProvider.get().equals(oldProvider); + return oldProvider != null && (this.providers.containsValue(oldProvider) + || this.defaultProvider.get().equals(oldProvider)); } private void shutdownProvider(FeatureProvider provider) { diff --git a/version.txt b/version.txt index dc1e644a..9c6d6293 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.6.0 +1.6.1