Skip to content

Commit

Permalink
Prevent race condition when activating with multiple activation handl…
Browse files Browse the repository at this point in the history
…ers (#2)

Pull request: #2
  • Loading branch information
lefou authored Feb 27, 2024
1 parent 83f8dc3 commit bf4ff7f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/domino/java/OsgiContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ public void start(final BundleContext context) {
private void internalStart() {
bundleContext.foreach(bc -> {
// Execute the handler if one was defined
foreach(bundleActiveHandler, handler -> {
final LinkedList<ActiveHandler> copy;
synchronized (bundleActiveHandler) {
copy = new LinkedList<>(bundleActiveHandler);
}
foreach(copy, handler -> {
if (!handler.isStarted()) {
handler.setStarted();
log.debug("Bundle {}: Starting whenBundleActive", Util.bundleName(bc));
Expand Down

0 comments on commit bf4ff7f

Please sign in to comment.