(felix-dev) branch http-4.x updated: FELIX-6683 : Reduce requests to service registry
This is an automated email from the ASF dual-hosted git repository. cziegeler pushed a commit to branch http-4.x in repository https://gitbox.apache.org/repos/asf/felix-dev.git The following commit(s) were added to refs/heads/http-4.x by this push: new b6b69ee8d8 FELIX-6683 : Reduce requests to service registry b6b69ee8d8 is described below commit b6b69ee8d8b2f55e54e674496f557e475f321c59 Author: Carsten Ziegeler AuthorDate: Sat Jan 20 15:53:24 2024 +0100 FELIX-6683 : Reduce requests to service registry --- .../internal/whiteboard/WhiteboardManager.java | 72 ++ http/bridge/pom.xml| 2 +- http/jetty/pom.xml | 2 +- 3 files changed, 34 insertions(+), 42 deletions(-) diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java b/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java index 5dcab3dc0c..cad571882a 100644 --- a/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java +++ b/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java @@ -511,51 +511,43 @@ public final class WhiteboardManager /** * Find the list of matching contexts for the whiteboard service */ -private List getMatchingContexts(final WhiteboardServiceInfo info) -{ +private List getMatchingContexts(final WhiteboardServiceInfo info) { final List result = new ArrayList<>(); -for(final List handlerList : this.contextMap.values()) -{ +for(final List handlerList : this.contextMap.values()) { final WhiteboardContextHandler h = handlerList.get(0); -// check whether the servlet context helper is visible to the whiteboard bundle -// see chapter 140.2 -boolean visible = h.getContextInfo().getServiceId() < 0; // internal ones are always visible -if ( !visible ) -{ -final String filterString = "(" + Constants.SERVICE_ID + "=" + String.valueOf(h.getContextInfo().getServiceId()) + ")"; -try -{ -final Collection> col = info.getServiceReference().getBundle().getBundleContext().getServiceReferences(ServletContextHelper.class, filterString); -if ( !col.isEmpty() ) -{ -visible = true; -} -} -catch ( final InvalidSyntaxException ise ) -{ -// we ignore this and treat it as an invisible service -} + +// check if the context matches +boolean matches = false; + +if ( h.getContextInfo().getServiceReference() != null ) { +matches = info.getContextSelectionFilter().match(h.getContextInfo().getServiceReference()); +} else { +final Map props = new HashMap<>(); + props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, h.getContextInfo().getName()); + props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, h.getContextInfo().getPath()); + props.put(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY, h.getContextInfo().getName()); + +matches = info.getContextSelectionFilter().matches(props); } -if ( visible ) -{ -if ( h.getContextInfo().getServiceReference() != null ) -{ -if ( info.getContextSelectionFilter().match(h.getContextInfo().getServiceReference()) ) -{ -result.add(h); -} -} -else -{ -final Map props = new HashMap<>(); - props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, h.getContextInfo().getName()); - props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, h.getContextInfo().getPath()); - props.put(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY, h.getContextInfo().getName()); -if ( info.getContextSelectionFilter().matches(props) ) -{ -result.add(h); +if (matches) { +// check whether the servlet context helper is visible to the whiteboard bundle +// see chapter 140.2 +boolean visible = h.getContextInfo().getServiceId() < 0; // internal ones are always visible +if ( !visible ) { +final String filterString = "(" + Constants.SERVICE_ID + "=" + String.valueOf(h.getContextInfo().getServiceId()) + ")"; +try { +final Collection> col =
(felix-dev) branch master updated: FELIX-6683 : Reduce requests to service registry
This is an automated email from the ASF dual-hosted git repository. cziegeler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/felix-dev.git The following commit(s) were added to refs/heads/master by this push: new 07823aeb19 FELIX-6683 : Reduce requests to service registry 07823aeb19 is described below commit 07823aeb19753bf93b60c08eb55256a5d6db900d Author: Carsten Ziegeler AuthorDate: Sat Jan 20 15:57:37 2024 +0100 FELIX-6683 : Reduce requests to service registry --- .../internal/whiteboard/WhiteboardManager.java | 43 ++ http/bridge/pom.xml| 2 +- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java b/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java index 93422105ba..f082122f7c 100644 --- a/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java +++ b/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java @@ -470,35 +470,32 @@ public final class WhiteboardManager /** * Find the list of matching contexts for the whiteboard service */ -private List getMatchingContexts(final WhiteboardServiceInfo info) -{ +private List getMatchingContexts(final WhiteboardServiceInfo info) { final List result = new ArrayList<>(); -for(final List handlerList : this.contextMap.values()) -{ +for(final List handlerList : this.contextMap.values()) { final WhiteboardContextHandler h = handlerList.get(0); -// check whether the servlet context helper is visible to the whiteboard bundle -// see chapter 140.2 -boolean visible = h.getContextInfo().getServiceId() < 0; // internal ones are always visible -if ( !visible ) -{ -final String filterString = "(" + Constants.SERVICE_ID + "=" + String.valueOf(h.getContextInfo().getServiceId()) + ")"; -try -{ -final ServiceReference[] col = info.getServiceReference().getBundle().getBundleContext().getServiceReferences(h.getContextInfo().getServiceType(), filterString); -if ( col !=null && col.length > 0 ) -{ -visible = true; + +// check if the context matches +final boolean matches = h.getContextInfo().match(info); +if (matches) { +// check whether the servlet context helper is visible to the whiteboard bundle +// see chapter 140.2 +boolean visible = h.getContextInfo().getServiceId() < 0; // internal ones are always visible +if ( !visible ) { +final String filterString = "(" + Constants.SERVICE_ID + "=" + String.valueOf(h.getContextInfo().getServiceId()) + ")"; +try { +final ServiceReference[] col = info.getServiceReference().getBundle().getBundleContext().getServiceReferences(h.getContextInfo().getServiceType(), filterString); +if ( col !=null && col.length > 0 ) { +visible = true; +} +} catch ( final InvalidSyntaxException ise ) { +// we ignore this and treat it as an invisible service } } -catch ( final InvalidSyntaxException ise ) -{ -// we ignore this and treat it as an invisible service +if ( visible ) { +result.add(h); } } -if ( visible && h.getContextInfo().match(info) ) -{ -result.add(h); -} } return result; } diff --git a/http/bridge/pom.xml b/http/bridge/pom.xml index 91cb19faee..801c372886 100644 --- a/http/bridge/pom.xml +++ b/http/bridge/pom.xml @@ -184,7 +184,7 @@ org.apache.felix org.apache.felix.http.base -5.1.4 +5.1.5-SNAPSHOT org.apache.felix
(felix-dev) branch master updated: FELIX-6683 : Update to Jetty 11.0.19
This is an automated email from the ASF dual-hosted git repository. cziegeler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/felix-dev.git The following commit(s) were added to refs/heads/master by this push: new 17ceea935d FELIX-6683 : Update to Jetty 11.0.19 17ceea935d is described below commit 17ceea935d7fe5c2d132c6f8da1b22bc214884f8 Author: Carsten Ziegeler AuthorDate: Sat Jan 20 15:59:10 2024 +0100 FELIX-6683 : Update to Jetty 11.0.19 --- http/jetty/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http/jetty/pom.xml b/http/jetty/pom.xml index b95c3d70a0..934ed9b435 100644 --- a/http/jetty/pom.xml +++ b/http/jetty/pom.xml @@ -42,7 +42,7 @@ 11 -11.0.18 +11.0.19 true
(felix-dev) branch master updated: FELIX-6685 : Update to Jetty 12.0.5
This is an automated email from the ASF dual-hosted git repository. cziegeler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/felix-dev.git The following commit(s) were added to refs/heads/master by this push: new 8561e70d8a FELIX-6685 : Update to Jetty 12.0.5 8561e70d8a is described below commit 8561e70d8a1f84a70a37cfdb61dd58583895108b Author: Carsten Ziegeler AuthorDate: Sat Jan 20 16:09:15 2024 +0100 FELIX-6685 : Update to Jetty 12.0.5 --- http/jetty12/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http/jetty12/pom.xml b/http/jetty12/pom.xml index 414aa0bc15..bff610fb04 100644 --- a/http/jetty12/pom.xml +++ b/http/jetty12/pom.xml @@ -42,7 +42,7 @@ 17 -12.0.4 +12.0.5 true