You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by "Daniel.Sun" <su...@apache.org> on 2018/01/04 14:49:43 UTC

About making ProxyGenerator singleton

Hi all,

         I found ProxyGenerator is instantiated only in tests(i.e. `new
ProxyGenerator()`) and in the ProxyGenerator itself[1]. In order to share
the adapter cache globally[2] and maximize the usage of the cache, how about
make ProxyGenerator singleton?  In addition, how about increase the default
size of the cache?(e.g. 64)

         Any thoughts?

Cheers,
Daniel.Sun

[1]
https://github.com/apache/groovy/blob/master/src/main/groovy/groovy/util/ProxyGenerator.java#L69
[2]
https://github.com/apache/groovy/blob/master/src/main/groovy/groovy/util/ProxyGenerator.java#L77




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Re: About making ProxyGenerator singleton

Posted by "Daniel.Sun" <su...@apache.org>.
Hi Paul,

> While Groovy's internal use of ProxyGenerator mainly follows the singleton
> pattern, it was designed to be generally used outside Groovy's internals -
> so it would be removal of a public api.
OK. Let's leave it as it is :-)

> Also, I am not sure whether
> org.codehaus.groovy.vmplugin.v7.TypeTransformers usage is via the
> INSTANCE.
I verified that`org.codehaus.groovy.vmplugin.v7.TypeTransformers` uses
INSTANCE.

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Re: About making ProxyGenerator singleton

Posted by Paul King <pa...@asert.com.au>.
While Groovy's internal use of ProxyGenerator mainly follows the singleton
pattern, it was designed to be generally used outside Groovy's internals -
so it would be removal of a public api.
We generally avoid that but if there is a great gain we could poll the
users and see if it is in widespread use and if not deprecate it (if no use
found) or make an internal copy.
Also, I am not sure
whether org.codehaus.groovy.vmplugin.v7.TypeTransformers usage is via the
INSTANCE.

Cheers, Paul.

On Fri, Jan 5, 2018 at 12:49 AM, Daniel.Sun <su...@apache.org> wrote:

> Hi all,
>
>          I found ProxyGenerator is instantiated only in tests(i.e. `new
> ProxyGenerator()`) and in the ProxyGenerator itself[1]. In order to share
> the adapter cache globally[2] and maximize the usage of the cache, how
> about
> make ProxyGenerator singleton?  In addition, how about increase the default
> size of the cache?(e.g. 64)
>
>          Any thoughts?
>
> Cheers,
> Daniel.Sun
>
> [1]
> https://github.com/apache/groovy/blob/master/src/main/groovy/groovy/util/
> ProxyGenerator.java#L69
> [2]
> https://github.com/apache/groovy/blob/master/src/main/groovy/groovy/util/
> ProxyGenerator.java#L77
>
>
>
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
>