[JIRA] (JSSH-5) ServiceableComponent should implement AutoClose

Rod Widdowson (Jira) jira at shibboleth.atlassian.net
Fri Nov 18 12:03:16 UTC 2022


Rod Widdowson ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=59fb32bbc24efb3c4ed3c977 ) *commented* on JSSH-5 ( https://shibboleth.atlassian.net/browse/JSSH-5?atlOrigin=eyJpIjoiODFjOTllOTI0MDBmNGI1NmFiNzU1ZTZiY2M3ZTMxMTgiLCJwIjoiaiJ9 )

Re: ServiceableComponent should implement AutoClose ( https://shibboleth.atlassian.net/browse/JSSH-5?atlOrigin=eyJpIjoiODFjOTllOTI0MDBmNGI1NmFiNzU1ZTZiY2M3ZTMxMTgiLCJwIjoiaiJ9 )

I’d need to interview this in the code, but I think that the answer is *not* that ServiceableComponent shouldn’t implement AutoCloseable, rather that our implementations should *not* inherit from AbstractServiceableComponent. (which is what we both said last night).

The example code we want to maintain

       try (final ServiceableComponent<AttributeFilter> component
                   = attributeFilterService.getServiceableComponent()) {
           if (null == component) {
               log.error("{} Error while filtering inbound attributes: Invalid Attribute Filter configuration",
                       getLogPrefix());
               attributeContext.setIdPAttributes(null);
           } else {
               final AttributeFilter filter = component.getComponent();
               filter.filterAttributes(filterContext);
               filterContext.getParent().removeSubcontext(filterContext);
               attributeContext.setIdPAttributes(filterContext.getFilteredIdPAttributes().values());
           }
       } 

because we want the locks inherent in getting the *component* to be dropped.

Code we want to drop

try (final AttributeFilterImpl filter = new AttributeFilterImpl("engine", Collections.emptyList())) {
           
           // TODO: this seems off but is needed to allow try-with-resources while also unlocking.
           filter.pinComponent();
           
           Assert.assertNotNull(filter.getFilterPolicies());
           Assert.assertTrue(filter.getFilterPolicies().isEmpty());
           Assert.assertEquals(filter.getId(), "engine");
       }

becaase its completely bogus that the *AttributeFilterImpl* is closeable.

I am pretty sure that we can fix this by creating a new ServicebleComponentImpl<foo> which takes a foo as its contructor and then summon up one of these in the Strategy which the parser uses, but I’d need to think long and hard about Spring lifetimes. because the AbstractServiceable Component (which all our impls currently inherit from is ApplicationContextAware

( https://shibboleth.atlassian.net/browse/JSSH-5#add-comment?atlOrigin=eyJpIjoiODFjOTllOTI0MDBmNGI1NmFiNzU1ZTZiY2M3ZTMxMTgiLCJwIjoiaiJ9 ) Add Comment ( https://shibboleth.atlassian.net/browse/JSSH-5#add-comment?atlOrigin=eyJpIjoiODFjOTllOTI0MDBmNGI1NmFiNzU1ZTZiY2M3ZTMxMTgiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100210- sha1:9b34d7c )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/commits/attachments/20221118/d37f1aa0/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-comment-icon-a03047eb-3906-4d09-8949-e8177f326abc
Type: image/png
Size: 1084 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20221118/d37f1aa0/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-footer-desktop-logo-d11f95da-baed-4355-a504-0f2d8aac97da
Type: image/png
Size: 10805 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20221118/d37f1aa0/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-avatar-8605b989-c0f4-4dc4-bb89-08cb90cf07ed
Type: image/png
Size: 468 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20221118/d37f1aa0/attachment-0005.png>


More information about the commits mailing list