You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geode.apache.org by Dan Smith <ds...@pivotal.io> on 2019/12/06 00:40:15 UTC

[DISCUSS] Replacing singleton PoolManager

Hi,

I wrote up a proposal for deprecating of the singleton PoolManager in favor
of a ClientCache scoped service. Please review and comment on the below
proposal.

I think this should address the issues that Spring Data Geode and friends
had trying to mock Pools and remove the need for those projects to try to
inject mock Pools into a Geode singleton.

https://cwiki.apache.org/confluence/display/GEODE/Replace+singleton+PoolManager+with+ClientCache+scoped+service

Thanks,
-Dan

Re: [DISCUSS] Replacing singleton PoolManager

Posted by Joris Melchior <jm...@pivotal.io>.
+1

On Thu, Dec 5, 2019 at 7:40 PM Dan Smith <ds...@pivotal.io> wrote:

> Hi,
>
> I wrote up a proposal for deprecating of the singleton PoolManager in favor
> of a ClientCache scoped service. Please review and comment on the below
> proposal.
>
> I think this should address the issues that Spring Data Geode and friends
> had trying to mock Pools and remove the need for those projects to try to
> inject mock Pools into a Geode singleton.
>
>
> https://cwiki.apache.org/confluence/display/GEODE/Replace+singleton+PoolManager+with+ClientCache+scoped+service
>
> Thanks,
> -Dan
>


-- 
*Joris Melchior *
CF Engineering
Pivotal Toronto
416 877 5427

“Programs must be written for people to read, and only incidentally for
machines to execute.” – *Hal Abelson*
<https://en.wikipedia.org/wiki/Hal_Abelson>

Re: [DISCUSS] Replacing singleton PoolManager

Posted by Jacob Barrett <jb...@pivotal.io>.
This is a great idea!

On thought though, did you consider just converting the existing PoolManager to an interface leaving the static methods intact but deprecated? I would think this would make existing code pretty easy to refactor over to the new code with minimal changes. If you thought about it can you add why you rejected it to the RFC.

-Jake


> On Dec 5, 2019, at 4:40 PM, Dan Smith <ds...@pivotal.io> wrote:
> 
> Hi,
> 
> I wrote up a proposal for deprecating of the singleton PoolManager in favor
> of a ClientCache scoped service. Please review and comment on the below
> proposal.
> 
> I think this should address the issues that Spring Data Geode and friends
> had trying to mock Pools and remove the need for those projects to try to
> inject mock Pools into a Geode singleton.
> 
> https://cwiki.apache.org/confluence/display/GEODE/Replace+singleton+PoolManager+with+ClientCache+scoped+service
> 
> Thanks,
> -Dan

Re: [DISCUSS] Replacing singleton PoolManager

Posted by Dale Emery <de...@pivotal.io>.
+1

To the extent possible without breaking existing APIs, please name the new stuff to indicate what’s in the pool (E.g. ConnectionPool, ConnectionPoolService, and so on).

—
Dale Emery
demery@pivotal.io



> On Dec 5, 2019, at 4:40 PM, Dan Smith <ds...@pivotal.io> wrote:
> 
> Hi,
> 
> I wrote up a proposal for deprecating of the singleton PoolManager in favor
> of a ClientCache scoped service. Please review and comment on the below
> proposal.
> 
> I think this should address the issues that Spring Data Geode and friends
> had trying to mock Pools and remove the need for those projects to try to
> inject mock Pools into a Geode singleton.
> 
> https://cwiki.apache.org/confluence/display/GEODE/Replace+singleton+PoolManager+with+ClientCache+scoped+service
> 
> Thanks,
> -Dan


Re: [DISCUSS] Replacing singleton PoolManager

Posted by Dan Smith <ds...@pivotal.io>.
It looks like we never came to a consensus on this thread, and meanwhile
the urgency for this fix has gone away. The original urgency was to give
spring data geode a way to avoid using internal APIs, but that has been
fixed a different way in SDG.

I still think this would be a good change to make to get away from needing
singletons in the future, but for now I've moved this to the icebox.

-Dan

On Mon, Dec 9, 2019 at 5:20 PM Dan Smith <ds...@pivotal.io> wrote:

> On Fri, Dec 6, 2019 at 10:45 AM Dale Emery <de...@pivotal.io> wrote:
>
>>
>> > Dale - are you suggesting a ConnectionPoolService that returns
>> ConnectionPool instances?
>>
>> Yes.
>>
>> > Would that mean ConnectionPool would extend Pool and we would deprecate
>> Pool itself?
>>
>> Maybe extend. I worry about extending, for two reasons.
>>
>> First, extending would make the new interface depend on the deprecated
>> one. That feels awkward for reasons I can’t articulate
>>
>> Second, extending would mean that the new interface gets all the methods
>> of the deprecated one whether we want them or not. I don’t know enough
>> about Pool to have an opinion about whether we want to carry all of its
>> method signatures forward.
>>
>> An alternative to consider: Each ConnectionPool implementation delegates
>> to a Pool. I suspect that this would make it harder to migrate existing
>> uses from Pool to ConnectionPool.
>>
>
> We could flip what extends what - Have Pool extend ConnectionPool.
> Deprecate Pool. This would affect the following public APIs:
>
> Pool: Would need to extend a new parent interface called ConnectionPool
> PoolFactory: Would also need a new parent interface called
> ConnectionPoolFactory
> FunctionService: Would need to take ConnectionPool instead of Pool
> ClientCacheFactory: Deprecate all the  setPoolXXX methods and add
> setConnectionPoolXXX?
> ClientCache: Deprecate getDefaultPool and add getDefaultConnectionPool?
> RegionFactory and RegionAttributes: Deprecate setPoolName and add
> setConnectionPoolName
> cache-1.0.xsd : Deprecate the <pool> elements and add <connection-pool>
> elements instead.
> This will also affect downstream projects that use a pool such as Spring
> Data Geode - that project will maybe want to rename PoolFactoryBean, etc.
>
> I guess I'm not sold that making all these name changes is worth it to
> users. Just removing the singleton as the current proposal stands is a much
> smaller scope of change. What do you all think?
>
> -Dan
>

Re: [DISCUSS] Replacing singleton PoolManager

Posted by Dan Smith <ds...@pivotal.io>.
On Fri, Dec 6, 2019 at 10:45 AM Dale Emery <de...@pivotal.io> wrote:

>
> > Dale - are you suggesting a ConnectionPoolService that returns
> ConnectionPool instances?
>
> Yes.
>
> > Would that mean ConnectionPool would extend Pool and we would deprecate
> Pool itself?
>
> Maybe extend. I worry about extending, for two reasons.
>
> First, extending would make the new interface depend on the deprecated
> one. That feels awkward for reasons I can’t articulate
>
> Second, extending would mean that the new interface gets all the methods
> of the deprecated one whether we want them or not. I don’t know enough
> about Pool to have an opinion about whether we want to carry all of its
> method signatures forward.
>
> An alternative to consider: Each ConnectionPool implementation delegates
> to a Pool. I suspect that this would make it harder to migrate existing
> uses from Pool to ConnectionPool.
>

We could flip what extends what - Have Pool extend ConnectionPool.
Deprecate Pool. This would affect the following public APIs:

Pool: Would need to extend a new parent interface called ConnectionPool
PoolFactory: Would also need a new parent interface called
ConnectionPoolFactory
FunctionService: Would need to take ConnectionPool instead of Pool
ClientCacheFactory: Deprecate all the  setPoolXXX methods and add
setConnectionPoolXXX?
ClientCache: Deprecate getDefaultPool and add getDefaultConnectionPool?
RegionFactory and RegionAttributes: Deprecate setPoolName and add
setConnectionPoolName
cache-1.0.xsd : Deprecate the <pool> elements and add <connection-pool>
elements instead.
This will also affect downstream projects that use a pool such as Spring
Data Geode - that project will maybe want to rename PoolFactoryBean, etc.

I guess I'm not sold that making all these name changes is worth it to
users. Just removing the singleton as the current proposal stands is a much
smaller scope of change. What do you all think?

-Dan

Re: [DISCUSS] Replacing singleton PoolManager

Posted by Dale Emery <de...@pivotal.io>.
> Dale - are you suggesting a ConnectionPoolService that returns ConnectionPool instances?

Yes.

> Would that mean ConnectionPool would extend Pool and we would deprecate Pool itself?

Maybe extend. I worry about extending, for two reasons.

First, extending would make the new interface depend on the deprecated one. That feels awkward for reasons I can’t articulate

Second, extending would mean that the new interface gets all the methods of the deprecated one whether we want them or not. I don’t know enough about Pool to have an opinion about whether we want to carry all of its method signatures forward.

An alternative to consider: Each ConnectionPool implementation delegates to a Pool. I suspect that this would make it harder to migrate existing uses from Pool to ConnectionPool.

—
Dale Emery
demery@pivotal.io


Re: [DISCUSS] Replacing singleton PoolManager

Posted by Aaron Lindsey <al...@pivotal.io>.
+1

Aaron

> On Dec 6, 2019, at 10:49 AM, Jacob Barrett <jb...@pivotal.io> wrote:
> 
> 
> 
>> On Dec 6, 2019, at 9:40 AM, Dan Smith <ds...@pivotal.io> wrote:
>> 
>> Regarding changing PoolManager to
>> an interface, I guess originally I wasn't thinking we would still be
>> backwards compatible if we did that. But as I think about it I think that
>> might be ok. One slight issue with that approach is that we have to come up
>> with new names for the methods - we can't have both an instance and a
>> static method with the same name and args. Maybe still worth it
> 
> Doh! I didn’t think about that. It sort of defeats the purpose of reusing the class. So going with a whole new class probably makes more sense to remove confusion.
> 
> -Jake
> 


Re: [DISCUSS] Replacing singleton PoolManager

Posted by Jacob Barrett <jb...@pivotal.io>.

> On Dec 6, 2019, at 9:40 AM, Dan Smith <ds...@pivotal.io> wrote:
> 
> Regarding changing PoolManager to
> an interface, I guess originally I wasn't thinking we would still be
> backwards compatible if we did that. But as I think about it I think that
> might be ok. One slight issue with that approach is that we have to come up
> with new names for the methods - we can't have both an instance and a
> static method with the same name and args. Maybe still worth it

Doh! I didn’t think about that. It sort of defeats the purpose of reusing the class. So going with a whole new class probably makes more sense to remove confusion.

-Jake


Re: [DISCUSS] Replacing singleton PoolManager

Posted by Dan Smith <ds...@pivotal.io>.
Jake wrote:

> On thought though, did you consider just converting the existing
> PoolManager to an interface leaving the static methods intact but
> deprecated?
>

Dale wrote:

> To the extent possible without breaking existing APIs, please name the new
> stuff to indicate what’s in the pool (E.g. ConnectionPool,
> ConnectionPoolService, and so on).



Dang, I like both of these suggestions!  Regarding changing PoolManager to
an interface, I guess originally I wasn't thinking we would still be
backwards compatible if we did that. But as I think about it I think that
might be ok. One slight issue with that approach is that we have to come up
with new names for the methods - we can't have both an instance and a
static method with the same name and args. Maybe still worth it

Dale - are you suggesting a ConnectionPoolService that returns
ConnectionPool instances? Would that mean ConnectionPool would extend Pool
and we would deprecate Pool itself?

-Dan

On Fri, Dec 6, 2019 at 8:32 AM Darrel Schneider <ds...@pivotal.io>
wrote:

> +1
>
> On Thu, Dec 5, 2019 at 4:40 PM Dan Smith <ds...@pivotal.io> wrote:
>
> > Hi,
> >
> > I wrote up a proposal for deprecating of the singleton PoolManager in
> favor
> > of a ClientCache scoped service. Please review and comment on the below
> > proposal.
> >
> > I think this should address the issues that Spring Data Geode and friends
> > had trying to mock Pools and remove the need for those projects to try to
> > inject mock Pools into a Geode singleton.
> >
> >
> >
> https://cwiki.apache.org/confluence/display/GEODE/Replace+singleton+PoolManager+with+ClientCache+scoped+service
> >
> > Thanks,
> > -Dan
> >
>

Re: [DISCUSS] Replacing singleton PoolManager

Posted by Darrel Schneider <ds...@pivotal.io>.
+1

On Thu, Dec 5, 2019 at 4:40 PM Dan Smith <ds...@pivotal.io> wrote:

> Hi,
>
> I wrote up a proposal for deprecating of the singleton PoolManager in favor
> of a ClientCache scoped service. Please review and comment on the below
> proposal.
>
> I think this should address the issues that Spring Data Geode and friends
> had trying to mock Pools and remove the need for those projects to try to
> inject mock Pools into a Geode singleton.
>
>
> https://cwiki.apache.org/confluence/display/GEODE/Replace+singleton+PoolManager+with+ClientCache+scoped+service
>
> Thanks,
> -Dan
>