[windup-dev] CDI question - producer

Ondrej Zizka ozizka at redhat.com
Tue Sep 9 18:29:32 EDT 2014


For the record:
There are few noticable things.

GraphContextImpl should be @Vetoed
So far it worked because it has no default constructor.

The test failure I was after was also in master.
But still the GraphContext is being initialized (!= constructed) on and on.

Rebasing & checking what's going on.

Ondra



On 9.9.2014 09:08, Ondrej Zizka wrote:
> Hi, with this
>
> ----------------------------------------------------------------
> @Singleton
> public class GraphContextFactoryImpl implements GraphContextFactory
> {
>       @Inject
>       private GraphApiCompositeClassLoaderProvider
> graphApiCompositeClassLoaderProvider;
>
>       @Inject
>       private Imported<Service<? extends VertexFrame>> graphServices;
>
>       @Inject
>       private GraphTypeRegistry graphTypeRegistry;
>
>       private GraphContext graphContext;
> ----------------------------------------------------------------
>
>
> is there a difference between the following two?
> Basically I just moved the core of the creation.
> A is master, B is my branch, results in the GraphContext being created
> at each @Inject.
> I think I am missing something here.
>
> Thanks, Ondra
>
>
> ---A-------------------------------------------------------------
>      @Override
>       public GraphContext create(){
>           return produceGraphContext();
>       }
>
>       @Produces  @ApplicationScoped
>       public GraphContext produceGraphContext(){
>            if (this.graphContext == null){
>               this.graphContext = new GraphContextImpl(graphServices,
> this.graphTypeRegistry, this.graphApiCompositeClassLoaderProvider);
>           }
>           return graphContext;
>       }
>
> ----B-----------------------------------------------------------
>
>       @Override
>       public GraphContext create()    {
>           return new GraphContextImpl(
>               this.graphServices,
>               this.graphTypeRegistry,
>               this.graphApiCompositeClassLoaderProvider);
>       }
>
>       @Produces  @ApplicationScoped
>       public GraphContext produceGraphContext(){
>           if (this.graphContext == null) {
>               this.graphContext = this.create();
>           }
>           return graphContext;
>       }
>
> _______________________________________________
> windup-dev mailing list
> windup-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/windup-dev



More information about the windup-dev mailing list