You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@reef.apache.org by Dhruv Mahajan <dh...@gmail.com> on 2015/10/28 23:23:44 UTC

binding interfaces to different implementation using named prameters

HI

I have a question.

I have two different implementations of IObserver<int> A and B that I want
to use in the same task. Now we know that we can not directly bind it to A
and B both using Tang. Is there an elegant workaround here. Can we use
NamedParameter for this?

Dhruv

Re: binding interfaces to different implementation using named prameters

Posted by Byung-Gon Chun <bg...@gmail.com>.
Hi again. We also have a few cases where we need this feature. So, we have
incentives to make it happen. :)

On Fri, Oct 30, 2015 at 1:47 PM, Byung-Gon Chun <bg...@gmail.com> wrote:

> The SNU team has been slowly making progress on REEF-31. We hope to
> address it by February.
>
>
>
> On Fri, Oct 30, 2015 at 5:16 AM, Dhruv Mahajan <dh...@gmail.com>
> wrote:
>
>> I see thks.
>>
>> On Thu, Oct 29, 2015 at 1:10 PM, Tobin Baker <td...@cs.washington.edu>
>> wrote:
>>
>> > Yep, I had to use a similar workaround to inject a NamedParameter with a
>> > different value for each Task (a single NamedParameter held a set of
>> > serialized Configuration objects for each Task, each of which held the
>> > appropriate NamedParameter value for the Task).
>> >
>> > On Thu, Oct 29, 2015 at 12:32 PM, Julia Wang (QIUHE) <
>> > Qiuhe.Wang@microsoft.com> wrote:
>> >
>> > > This is an existing limitation of Tang, REEF-31.
>> > >
>> > > A work around is
>> > > - Create serialized configuration as a string for each implementation
>> > > - Use Set<string> as a named parameter to pass the serialized
>> > > configurations to the constructor you would like
>> > > - Inside the constructor, for each string in the set, folk the
>> injector
>> > > passed in the constructor with the configuration deserialized, then
>> > > GetInstance() with the forked injector
>> > >
>> > > Hope that helps.
>> > >
>> > > Julia
>> > >
>> > >
>> > > -----Original Message-----
>> > > From: Dhruv Mahajan [mailto:dhruv.mahajan@gmail.com]
>> > > Sent: Wednesday, October 28, 2015 3:24 PM
>> > > To: dev@reef.incubator.apache.org
>> > > Subject: binding interfaces to different implementation using named
>> > > prameters
>> > >
>> > > HI
>> > >
>> > > I have a question.
>> > >
>> > > I have two different implementations of IObserver<int> A and B that I
>> > want
>> > > to use in the same task. Now we know that we can not directly bind it
>> to
>> > A
>> > > and B both using Tang. Is there an elegant workaround here. Can we use
>> > > NamedParameter for this?
>> > >
>> > > Dhruv
>> > >
>> >
>>
>
>
>
> --
> Byung-Gon Chun
>



-- 
Byung-Gon Chun

Re: binding interfaces to different implementation using named prameters

Posted by Byung-Gon Chun <bg...@gmail.com>.
The SNU team has been slowly making progress on REEF-31. We hope to address
it by February.



On Fri, Oct 30, 2015 at 5:16 AM, Dhruv Mahajan <dh...@gmail.com>
wrote:

> I see thks.
>
> On Thu, Oct 29, 2015 at 1:10 PM, Tobin Baker <td...@cs.washington.edu>
> wrote:
>
> > Yep, I had to use a similar workaround to inject a NamedParameter with a
> > different value for each Task (a single NamedParameter held a set of
> > serialized Configuration objects for each Task, each of which held the
> > appropriate NamedParameter value for the Task).
> >
> > On Thu, Oct 29, 2015 at 12:32 PM, Julia Wang (QIUHE) <
> > Qiuhe.Wang@microsoft.com> wrote:
> >
> > > This is an existing limitation of Tang, REEF-31.
> > >
> > > A work around is
> > > - Create serialized configuration as a string for each implementation
> > > - Use Set<string> as a named parameter to pass the serialized
> > > configurations to the constructor you would like
> > > - Inside the constructor, for each string in the set, folk the injector
> > > passed in the constructor with the configuration deserialized, then
> > > GetInstance() with the forked injector
> > >
> > > Hope that helps.
> > >
> > > Julia
> > >
> > >
> > > -----Original Message-----
> > > From: Dhruv Mahajan [mailto:dhruv.mahajan@gmail.com]
> > > Sent: Wednesday, October 28, 2015 3:24 PM
> > > To: dev@reef.incubator.apache.org
> > > Subject: binding interfaces to different implementation using named
> > > prameters
> > >
> > > HI
> > >
> > > I have a question.
> > >
> > > I have two different implementations of IObserver<int> A and B that I
> > want
> > > to use in the same task. Now we know that we can not directly bind it
> to
> > A
> > > and B both using Tang. Is there an elegant workaround here. Can we use
> > > NamedParameter for this?
> > >
> > > Dhruv
> > >
> >
>



-- 
Byung-Gon Chun

Re: binding interfaces to different implementation using named prameters

Posted by Dhruv Mahajan <dh...@gmail.com>.
I see thks.

On Thu, Oct 29, 2015 at 1:10 PM, Tobin Baker <td...@cs.washington.edu>
wrote:

> Yep, I had to use a similar workaround to inject a NamedParameter with a
> different value for each Task (a single NamedParameter held a set of
> serialized Configuration objects for each Task, each of which held the
> appropriate NamedParameter value for the Task).
>
> On Thu, Oct 29, 2015 at 12:32 PM, Julia Wang (QIUHE) <
> Qiuhe.Wang@microsoft.com> wrote:
>
> > This is an existing limitation of Tang, REEF-31.
> >
> > A work around is
> > - Create serialized configuration as a string for each implementation
> > - Use Set<string> as a named parameter to pass the serialized
> > configurations to the constructor you would like
> > - Inside the constructor, for each string in the set, folk the injector
> > passed in the constructor with the configuration deserialized, then
> > GetInstance() with the forked injector
> >
> > Hope that helps.
> >
> > Julia
> >
> >
> > -----Original Message-----
> > From: Dhruv Mahajan [mailto:dhruv.mahajan@gmail.com]
> > Sent: Wednesday, October 28, 2015 3:24 PM
> > To: dev@reef.incubator.apache.org
> > Subject: binding interfaces to different implementation using named
> > prameters
> >
> > HI
> >
> > I have a question.
> >
> > I have two different implementations of IObserver<int> A and B that I
> want
> > to use in the same task. Now we know that we can not directly bind it to
> A
> > and B both using Tang. Is there an elegant workaround here. Can we use
> > NamedParameter for this?
> >
> > Dhruv
> >
>

Re: binding interfaces to different implementation using named prameters

Posted by Tobin Baker <td...@cs.washington.edu>.
Yep, I had to use a similar workaround to inject a NamedParameter with a
different value for each Task (a single NamedParameter held a set of
serialized Configuration objects for each Task, each of which held the
appropriate NamedParameter value for the Task).

On Thu, Oct 29, 2015 at 12:32 PM, Julia Wang (QIUHE) <
Qiuhe.Wang@microsoft.com> wrote:

> This is an existing limitation of Tang, REEF-31.
>
> A work around is
> - Create serialized configuration as a string for each implementation
> - Use Set<string> as a named parameter to pass the serialized
> configurations to the constructor you would like
> - Inside the constructor, for each string in the set, folk the injector
> passed in the constructor with the configuration deserialized, then
> GetInstance() with the forked injector
>
> Hope that helps.
>
> Julia
>
>
> -----Original Message-----
> From: Dhruv Mahajan [mailto:dhruv.mahajan@gmail.com]
> Sent: Wednesday, October 28, 2015 3:24 PM
> To: dev@reef.incubator.apache.org
> Subject: binding interfaces to different implementation using named
> prameters
>
> HI
>
> I have a question.
>
> I have two different implementations of IObserver<int> A and B that I want
> to use in the same task. Now we know that we can not directly bind it to A
> and B both using Tang. Is there an elegant workaround here. Can we use
> NamedParameter for this?
>
> Dhruv
>

RE: binding interfaces to different implementation using named prameters

Posted by "Julia Wang (QIUHE)" <Qi...@microsoft.com>.
This is an existing limitation of Tang, REEF-31. 

A work around is
- Create serialized configuration as a string for each implementation
- Use Set<string> as a named parameter to pass the serialized configurations to the constructor you would like
- Inside the constructor, for each string in the set, folk the injector passed in the constructor with the configuration deserialized, then GetInstance() with the forked injector

Hope that helps.

Julia


-----Original Message-----
From: Dhruv Mahajan [mailto:dhruv.mahajan@gmail.com] 
Sent: Wednesday, October 28, 2015 3:24 PM
To: dev@reef.incubator.apache.org
Subject: binding interfaces to different implementation using named prameters

HI

I have a question.

I have two different implementations of IObserver<int> A and B that I want to use in the same task. Now we know that we can not directly bind it to A and B both using Tang. Is there an elegant workaround here. Can we use NamedParameter for this?

Dhruv