created https://issues.apache.org/jira/browse/GERONIMO-6570
Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://blog-rmannibucau.rhcloud.com> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory <https://javaeefactory-rmannibucau.rhcloud.com> 2017-07-02 14:20 GMT+02:00 Romain Manni-Bucau <[email protected]>: > Can tmr yes > > Le 2 juil. 2017 13:29, "Mark Struberg" <[email protected]> a écrit : > >> +1 for the old pattern. >> Do you create a ticket for it? >> >> LieGrue, >> strub >> >> >> > Am 01.07.2017 um 14:29 schrieb Romain Manni-Bucau < >> [email protected]>: >> > >> > Hi guys, >> > >> > just saw how javax.enterprise.inject.se.SeC >> ontainerInitializer#newInstance has been implemented. I'm not sure it >> was based on the ref implementation but - ignoring for now the OSGi issues >> - I don't think it works: >> > >> > long exactSize = serviceLoader.spliterator().getExactSizeIfKnown(); >> > if(exactSize == 0) >> > { >> > throw new IllegalStateException("No valid implementation of >> SeContainerInitializer found via ServiceLoader"); >> > } >> > else if(exactSize > 1) >> > { >> > throw new IllegalStateException("Multiple implementations >> ("+exactSize+") of SeContainerInitializer found via ServiceLoader"); >> > } >> > return serviceLoader.iterator().next(); >> > >> > exactSize will be -1 since the splititerator doesnt have the size as a >> characteristic so we'll always be not deterministic which seems not >> intended. >> > >> > Am I missing anything? >> > >> > Do we want to use the old instance = next(); if (hasNext()) fail(); >> pattern? >> > >> > Romain Manni-Bucau >> > @rmannibucau | Blog | Old Blog | Github | LinkedIn | JavaEE Factory >> >>
