geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: [spec / cdi 2] bad impl for javax.enterprise.inject.se.SeContainerInitializer#newInstance?
Date Sun, 02 Jul 2017 12:20:28 GMT
Can tmr yes

Le 2 juil. 2017 13:29, "Mark Struberg" <struberg@yahoo.de> 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 <rmannibucau@gmail.com
> >:
> >
> > Hi guys,
> >
> > just saw how javax.enterprise.inject.se.SeContainerInitializer#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
>
>

Mime
View raw message