You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Maxim Solodovnik <so...@gmail.com> on 2018/09/19 04:42:47 UTC

commons-collections4 migration question

Hello All,

I'm currently working on PR to migrate OpenJpa to latest commons-collections4
During this work I noticed commons-collections4 API was changed

After discussion in commons mailing list [1] I have proposed the PR
[2] to commons collections
During writing the test for this changes I noticed
org.apache.commons.collections4.map.ReferenceMap can be cleaned up and
method purge will not be called ...

As far as I can understand
org.apache.openjpa.lib.util.ReferenceHashMap was designed to call
keyExpired/valueExpired in case key/value were expired, and these
methods will not be called in case Map will be auto-clean-up by GC. Is
this OK?

[1] https://markmail.org/thread/tshcd4d54nxrvgbu
[2] https://github.com/apache/commons-collections/pull/51

-- 
WBR
Maxim aka solomax

***UNCHECKED*** Re: commons-collections4 migration question

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Can be done by iterations. Point was more that if migration starts to be
costly then the drop can be a good option. All we use is quite easy to
replace by java8 API and a few glue AFAIK.
That said no issue to start smaller ;), any step forward is very appreciated

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le mer. 19 sept. 2018 à 08:39, Francesco Chicchiriccò <il...@apache.org>
a écrit :

> Hi,
> besides
>
> org.apache.commons.collections.Predicate
>
> which should be replaceable by
>
> java.util.function.Predicate
>
> I don't see unfortunately any other low-hanging fruit here.
>
> Regards.
>
> On 19/09/2018 08:36, Maxim Solodovnik wrote:
> > I'm afraid this wouldn't be task for newbie :(((
> >
> > These classes are being used:
> >
> > org.apache.commons.collections.IdentityMap --- replaced with
> > java.util.IdentityHashMap
> > org.apache.commons.collections.map.LRUMap  -- extended by OpenJpa
> > org.apache.commons.collections.map.ReferenceMap -- extended by OpenJpa
> >
> > org.apache.commons.collections.bidimap.TreeBidiMap;
> > org.apache.commons.collections.comparators.ComparableComparator;
> > org.apache.commons.collections.comparators.ComparatorChain;
> > org.apache.commons.collections.iterators.EmptyIterator;
> > org.apache.commons.collections.iterators.FilterIterator;
> > org.apache.commons.collections.iterators.IteratorChain;
> > org.apache.commons.collections.map.LinkedMap;
> > org.apache.commons.collections.Predicate;
> > org.apache.commons.collections.SequencedHashMap;
> > org.apache.commons.collections.set.MapBackedSet;
> >
> > Please let me know if will handle this one
> > On Wed, 19 Sep 2018 at 13:20, Mark Struberg <st...@yahoo.de.invalid>
> wrote:
> >> +1 for inlining the functionality if possible.
> >>
> >> I already started with a cleanup and got rid of quite a few external
> dependencies.
> >> Probably there is one more to go.
> >> In any case thanks for your help Maxim!
> >>
> >> LieGrue,
> >> strub
> >>
> >>> Am 19.09.2018 um 07:43 schrieb Romain Manni-Bucau <
> rmannibucau@gmail.com>:
> >>>
> >>> Hi Maxim,
> >>>
> >>> I think it would be ok since it is really to enable GC AFAIK.
> >>>
> >>> Side note: did you evaluate dropping commons-collection from the
> codebase?
> >>> don't think we abuse of it to justify the dependency.
> >>>
> >>> Romain Manni-Bucau
> >>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >>> <https://rmannibucau.metawerx.net/> | Old Blog
> >>> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> >>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> >>> <
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> >
> >>>
> >>>
> >>> Le mer. 19 sept. 2018 à 06:43, Maxim Solodovnik <so...@gmail.com>
> a
> >>> écrit :
> >>>
> >>>> Hello All,
> >>>>
> >>>> I'm currently working on PR to migrate OpenJpa to latest
> >>>> commons-collections4
> >>>> During this work I noticed commons-collections4 API was changed
> >>>>
> >>>> After discussion in commons mailing list [1] I have proposed the PR
> >>>> [2] to commons collections
> >>>> During writing the test for this changes I noticed
> >>>> org.apache.commons.collections4.map.ReferenceMap can be cleaned up and
> >>>> method purge will not be called ...
> >>>>
> >>>> As far as I can understand
> >>>> org.apache.openjpa.lib.util.ReferenceHashMap was designed to call
> >>>> keyExpired/valueExpired in case key/value were expired, and these
> >>>> methods will not be called in case Map will be auto-clean-up by GC. Is
> >>>> this OK?
> >>>>
> >>>> [1] https://markmail.org/thread/tshcd4d54nxrvgbu
> >>>> [2] https://github.com/apache/commons-collections/pull/51
> >>>>
> >>>> --
> >>>> WBR
> >>>> Maxim aka solomax
> >>>>
> --
> Francesco Chicchiriccò
>
> Tirasa - Open Source Excellence
> http://www.tirasa.net/
>
> Member at The Apache Software Foundation
> Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
> http://home.apache.org/~ilgrosso/
>
>

Re: commons-collections4 migration question

Posted by Maxim Solodovnik <so...@gmail.com>.
OK,
My PR for commons-collections was merged,

PR for openjpa is created :)
Please check :)
On Wed, 19 Sep 2018 at 13:39, Francesco Chicchiriccò
<il...@apache.org> wrote:
>
> Hi,
> besides
>
> org.apache.commons.collections.Predicate
>
> which should be replaceable by
>
> java.util.function.Predicate
>
> I don't see unfortunately any other low-hanging fruit here.
>
> Regards.
>
> On 19/09/2018 08:36, Maxim Solodovnik wrote:
> > I'm afraid this wouldn't be task for newbie :(((
> >
> > These classes are being used:
> >
> > org.apache.commons.collections.IdentityMap --- replaced with
> > java.util.IdentityHashMap
> > org.apache.commons.collections.map.LRUMap  -- extended by OpenJpa
> > org.apache.commons.collections.map.ReferenceMap -- extended by OpenJpa
> >
> > org.apache.commons.collections.bidimap.TreeBidiMap;
> > org.apache.commons.collections.comparators.ComparableComparator;
> > org.apache.commons.collections.comparators.ComparatorChain;
> > org.apache.commons.collections.iterators.EmptyIterator;
> > org.apache.commons.collections.iterators.FilterIterator;
> > org.apache.commons.collections.iterators.IteratorChain;
> > org.apache.commons.collections.map.LinkedMap;
> > org.apache.commons.collections.Predicate;
> > org.apache.commons.collections.SequencedHashMap;
> > org.apache.commons.collections.set.MapBackedSet;
> >
> > Please let me know if will handle this one
> > On Wed, 19 Sep 2018 at 13:20, Mark Struberg <st...@yahoo.de.invalid> wrote:
> >> +1 for inlining the functionality if possible.
> >>
> >> I already started with a cleanup and got rid of quite a few external dependencies.
> >> Probably there is one more to go.
> >> In any case thanks for your help Maxim!
> >>
> >> LieGrue,
> >> strub
> >>
> >>> Am 19.09.2018 um 07:43 schrieb Romain Manni-Bucau <rm...@gmail.com>:
> >>>
> >>> Hi Maxim,
> >>>
> >>> I think it would be ok since it is really to enable GC AFAIK.
> >>>
> >>> Side note: did you evaluate dropping commons-collection from the codebase?
> >>> don't think we abuse of it to justify the dependency.
> >>>
> >>> Romain Manni-Bucau
> >>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >>> <https://rmannibucau.metawerx.net/> | Old Blog
> >>> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> >>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> >>> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
> >>>
> >>>
> >>> Le mer. 19 sept. 2018 à 06:43, Maxim Solodovnik <so...@gmail.com> a
> >>> écrit :
> >>>
> >>>> Hello All,
> >>>>
> >>>> I'm currently working on PR to migrate OpenJpa to latest
> >>>> commons-collections4
> >>>> During this work I noticed commons-collections4 API was changed
> >>>>
> >>>> After discussion in commons mailing list [1] I have proposed the PR
> >>>> [2] to commons collections
> >>>> During writing the test for this changes I noticed
> >>>> org.apache.commons.collections4.map.ReferenceMap can be cleaned up and
> >>>> method purge will not be called ...
> >>>>
> >>>> As far as I can understand
> >>>> org.apache.openjpa.lib.util.ReferenceHashMap was designed to call
> >>>> keyExpired/valueExpired in case key/value were expired, and these
> >>>> methods will not be called in case Map will be auto-clean-up by GC. Is
> >>>> this OK?
> >>>>
> >>>> [1] https://markmail.org/thread/tshcd4d54nxrvgbu
> >>>> [2] https://github.com/apache/commons-collections/pull/51
> >>>>
> >>>> --
> >>>> WBR
> >>>> Maxim aka solomax
> >>>>
> --
> Francesco Chicchiriccò
>
> Tirasa - Open Source Excellence
> http://www.tirasa.net/
>
> Member at The Apache Software Foundation
> Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
> http://home.apache.org/~ilgrosso/
>


-- 
WBR
Maxim aka solomax

Re: commons-collections4 migration question

Posted by Francesco Chicchiriccò <il...@apache.org>.
Hi,
besides

org.apache.commons.collections.Predicate

which should be replaceable by

java.util.function.Predicate

I don't see unfortunately any other low-hanging fruit here.

Regards.

On 19/09/2018 08:36, Maxim Solodovnik wrote:
> I'm afraid this wouldn't be task for newbie :(((
>
> These classes are being used:
>
> org.apache.commons.collections.IdentityMap --- replaced with
> java.util.IdentityHashMap
> org.apache.commons.collections.map.LRUMap  -- extended by OpenJpa
> org.apache.commons.collections.map.ReferenceMap -- extended by OpenJpa
>
> org.apache.commons.collections.bidimap.TreeBidiMap;
> org.apache.commons.collections.comparators.ComparableComparator;
> org.apache.commons.collections.comparators.ComparatorChain;
> org.apache.commons.collections.iterators.EmptyIterator;
> org.apache.commons.collections.iterators.FilterIterator;
> org.apache.commons.collections.iterators.IteratorChain;
> org.apache.commons.collections.map.LinkedMap;
> org.apache.commons.collections.Predicate;
> org.apache.commons.collections.SequencedHashMap;
> org.apache.commons.collections.set.MapBackedSet;
>
> Please let me know if will handle this one
> On Wed, 19 Sep 2018 at 13:20, Mark Struberg <st...@yahoo.de.invalid> wrote:
>> +1 for inlining the functionality if possible.
>>
>> I already started with a cleanup and got rid of quite a few external dependencies.
>> Probably there is one more to go.
>> In any case thanks for your help Maxim!
>>
>> LieGrue,
>> strub
>>
>>> Am 19.09.2018 um 07:43 schrieb Romain Manni-Bucau <rm...@gmail.com>:
>>>
>>> Hi Maxim,
>>>
>>> I think it would be ok since it is really to enable GC AFAIK.
>>>
>>> Side note: did you evaluate dropping commons-collection from the codebase?
>>> don't think we abuse of it to justify the dependency.
>>>
>>> Romain Manni-Bucau
>>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>>> <https://rmannibucau.metawerx.net/> | Old Blog
>>> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
>>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
>>> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
>>>
>>>
>>> Le mer. 19 sept. 2018 à 06:43, Maxim Solodovnik <so...@gmail.com> a
>>> écrit :
>>>
>>>> Hello All,
>>>>
>>>> I'm currently working on PR to migrate OpenJpa to latest
>>>> commons-collections4
>>>> During this work I noticed commons-collections4 API was changed
>>>>
>>>> After discussion in commons mailing list [1] I have proposed the PR
>>>> [2] to commons collections
>>>> During writing the test for this changes I noticed
>>>> org.apache.commons.collections4.map.ReferenceMap can be cleaned up and
>>>> method purge will not be called ...
>>>>
>>>> As far as I can understand
>>>> org.apache.openjpa.lib.util.ReferenceHashMap was designed to call
>>>> keyExpired/valueExpired in case key/value were expired, and these
>>>> methods will not be called in case Map will be auto-clean-up by GC. Is
>>>> this OK?
>>>>
>>>> [1] https://markmail.org/thread/tshcd4d54nxrvgbu
>>>> [2] https://github.com/apache/commons-collections/pull/51
>>>>
>>>> --
>>>> WBR
>>>> Maxim aka solomax
>>>>
-- 
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/


Re: commons-collections4 migration question

Posted by Maxim Solodovnik <so...@gmail.com>.
I'm afraid this wouldn't be task for newbie :(((

These classes are being used:

org.apache.commons.collections.IdentityMap --- replaced with
java.util.IdentityHashMap
org.apache.commons.collections.map.LRUMap  -- extended by OpenJpa
org.apache.commons.collections.map.ReferenceMap -- extended by OpenJpa

org.apache.commons.collections.bidimap.TreeBidiMap;
org.apache.commons.collections.comparators.ComparableComparator;
org.apache.commons.collections.comparators.ComparatorChain;
org.apache.commons.collections.iterators.EmptyIterator;
org.apache.commons.collections.iterators.FilterIterator;
org.apache.commons.collections.iterators.IteratorChain;
org.apache.commons.collections.map.LinkedMap;
org.apache.commons.collections.Predicate;
org.apache.commons.collections.SequencedHashMap;
org.apache.commons.collections.set.MapBackedSet;

Please let me know if will handle this one
On Wed, 19 Sep 2018 at 13:20, Mark Struberg <st...@yahoo.de.invalid> wrote:
>
> +1 for inlining the functionality if possible.
>
> I already started with a cleanup and got rid of quite a few external dependencies.
> Probably there is one more to go.
> In any case thanks for your help Maxim!
>
> LieGrue,
> strub
>
> > Am 19.09.2018 um 07:43 schrieb Romain Manni-Bucau <rm...@gmail.com>:
> >
> > Hi Maxim,
> >
> > I think it would be ok since it is really to enable GC AFAIK.
> >
> > Side note: did you evaluate dropping commons-collection from the codebase?
> > don't think we abuse of it to justify the dependency.
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://rmannibucau.metawerx.net/> | Old Blog
> > <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> > <https://www.packtpub.com/application-development/java-ee-8-high-performance>
> >
> >
> > Le mer. 19 sept. 2018 à 06:43, Maxim Solodovnik <so...@gmail.com> a
> > écrit :
> >
> >> Hello All,
> >>
> >> I'm currently working on PR to migrate OpenJpa to latest
> >> commons-collections4
> >> During this work I noticed commons-collections4 API was changed
> >>
> >> After discussion in commons mailing list [1] I have proposed the PR
> >> [2] to commons collections
> >> During writing the test for this changes I noticed
> >> org.apache.commons.collections4.map.ReferenceMap can be cleaned up and
> >> method purge will not be called ...
> >>
> >> As far as I can understand
> >> org.apache.openjpa.lib.util.ReferenceHashMap was designed to call
> >> keyExpired/valueExpired in case key/value were expired, and these
> >> methods will not be called in case Map will be auto-clean-up by GC. Is
> >> this OK?
> >>
> >> [1] https://markmail.org/thread/tshcd4d54nxrvgbu
> >> [2] https://github.com/apache/commons-collections/pull/51
> >>
> >> --
> >> WBR
> >> Maxim aka solomax
> >>
>


-- 
WBR
Maxim aka solomax

Re: commons-collections4 migration question

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
+1 for inlining the functionality if possible.

I already started with a cleanup and got rid of quite a few external dependencies. 
Probably there is one more to go.
In any case thanks for your help Maxim!

LieGrue,
strub

> Am 19.09.2018 um 07:43 schrieb Romain Manni-Bucau <rm...@gmail.com>:
> 
> Hi Maxim,
> 
> I think it would be ok since it is really to enable GC AFAIK.
> 
> Side note: did you evaluate dropping commons-collection from the codebase?
> don't think we abuse of it to justify the dependency.
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://rmannibucau.metawerx.net/> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
> 
> 
> Le mer. 19 sept. 2018 à 06:43, Maxim Solodovnik <so...@gmail.com> a
> écrit :
> 
>> Hello All,
>> 
>> I'm currently working on PR to migrate OpenJpa to latest
>> commons-collections4
>> During this work I noticed commons-collections4 API was changed
>> 
>> After discussion in commons mailing list [1] I have proposed the PR
>> [2] to commons collections
>> During writing the test for this changes I noticed
>> org.apache.commons.collections4.map.ReferenceMap can be cleaned up and
>> method purge will not be called ...
>> 
>> As far as I can understand
>> org.apache.openjpa.lib.util.ReferenceHashMap was designed to call
>> keyExpired/valueExpired in case key/value were expired, and these
>> methods will not be called in case Map will be auto-clean-up by GC. Is
>> this OK?
>> 
>> [1] https://markmail.org/thread/tshcd4d54nxrvgbu
>> [2] https://github.com/apache/commons-collections/pull/51
>> 
>> --
>> WBR
>> Maxim aka solomax
>> 


Re: commons-collections4 migration question

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Maxim,

I think it would be ok since it is really to enable GC AFAIK.

Side note: did you evaluate dropping commons-collection from the codebase?
don't think we abuse of it to justify the dependency.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le mer. 19 sept. 2018 à 06:43, Maxim Solodovnik <so...@gmail.com> a
écrit :

> Hello All,
>
> I'm currently working on PR to migrate OpenJpa to latest
> commons-collections4
> During this work I noticed commons-collections4 API was changed
>
> After discussion in commons mailing list [1] I have proposed the PR
> [2] to commons collections
> During writing the test for this changes I noticed
> org.apache.commons.collections4.map.ReferenceMap can be cleaned up and
> method purge will not be called ...
>
> As far as I can understand
> org.apache.openjpa.lib.util.ReferenceHashMap was designed to call
> keyExpired/valueExpired in case key/value were expired, and these
> methods will not be called in case Map will be auto-clean-up by GC. Is
> this OK?
>
> [1] https://markmail.org/thread/tshcd4d54nxrvgbu
> [2] https://github.com/apache/commons-collections/pull/51
>
> --
> WBR
> Maxim aka solomax
>