-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a more less intrusive approach...
- Loading branch information
Showing
6 changed files
with
40 additions
and
62 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...les/org.eclipse.osgi/META-INF/services/org.osgi.framework.connect.ConnectFrameworkFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
org.eclipse.osgi.launch.EquinoxFactory | ||
org.eclipse.osgi.internal.framework.ConnectFrameworkUtilHelper |
28 changes: 28 additions & 0 deletions
28
...se.osgi/container/src/org/eclipse/osgi/internal/framework/ConnectFrameworkUtilHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.eclipse.osgi.internal.framework; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.WeakHashMap; | ||
import org.osgi.framework.Bundle; | ||
import org.osgi.framework.connect.FrameworkUtilHelper; | ||
|
||
public class ConnectFrameworkUtilHelper implements FrameworkUtilHelper { | ||
static final Set<FrameworkUtilHelper> connectHelpers = Collections.newSetFromMap(new WeakHashMap<>()); | ||
|
||
@Override | ||
public Optional<Bundle> getBundle(Class<?> classFromBundle) { | ||
FrameworkUtilHelper[] helpers; | ||
synchronized (connectHelpers) { | ||
helpers = connectHelpers.toArray(FrameworkUtilHelper[]::new); | ||
} | ||
return Arrays.stream(helpers).filter(Objects::nonNull) | ||
.flatMap(helper -> helper.getBundle(classFromBundle).stream()).findFirst(); | ||
} | ||
|
||
public static synchronized void add(FrameworkUtilHelper moduleConnector) { | ||
connectHelpers.add(moduleConnector); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ConnectFramework.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters