You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by kw...@apache.org on 2022/07/18 13:41:44 UTC
[jackrabbit-oak] branch trunk updated: OAK-9840: Revert to static reference binding for MountInfoConfigs
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/trunk by this push:
new 8f9b99371e OAK-9840: Revert to static reference binding for MountInfoConfigs
8f9b99371e is described below
commit 8f9b99371e79783abfd6b6f2fa9cfff172985aae
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Mon Jul 18 15:41:38 2022 +0200
OAK-9840: Revert to static reference binding for MountInfoConfigs
No need for CopyOnWriteArrayList as always called from the same thread
Dynamic references would require more complex logic of unregistering the
MountInfoProviderService
---
.../jackrabbit/oak/composite/MountInfoProviderService.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/MountInfoProviderService.java b/oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/MountInfoProviderService.java
index 4dd1c08093..8b460bde69 100644
--- a/oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/MountInfoProviderService.java
+++ b/oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/MountInfoProviderService.java
@@ -23,7 +23,6 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Stream;
import org.apache.jackrabbit.oak.spi.mount.MountInfoProvider;
import org.apache.jackrabbit.oak.spi.mount.Mounts;
@@ -34,7 +33,6 @@ import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.osgi.service.component.annotations.ReferencePolicy;
import org.osgi.service.component.annotations.ReferencePolicyOption;
import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.Designate;
@@ -44,6 +42,8 @@ import org.slf4j.LoggerFactory;
import static java.util.stream.Collectors.toSet;
+import java.util.ArrayList;
+
@Component
@Designate(ocd = MountInfoProviderService.Props.class)
public class MountInfoProviderService {
@@ -90,7 +90,7 @@ public class MountInfoProviderService {
}
- private final List<MountInfoConfig> mountInfoConfigs = new CopyOnWriteArrayList<>();
+ private final List<MountInfoConfig> mountInfoConfigs = new ArrayList<>();
private Set<String> expectedMounts;
private ServiceRegistration reg;
@@ -127,12 +127,12 @@ public class MountInfoProviderService {
}
}
- @Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
+ @Reference(cardinality = ReferenceCardinality.MULTIPLE, policyOption = ReferencePolicyOption.GREEDY)
protected void bindMountInfoConfig(MountInfoConfig config) {
if (!config.getPaths().isEmpty()) { // Ignore empty configs
mountInfoConfigs.add(config);
}
- registerMountInfoProvider();
+ // this is a static reference, i.e. called before activate(), the registration happens during activate()
}
private void registerMountInfoProvider() {