You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directmemory.apache.org by Olivier Lamy <ol...@apache.org> on 2012/02/21 18:59:14 UTC

chicken and eggs issue in Cache class (configuration mechanism)

Currently Solr test failed due to a chicken and eggs issue.

    private static CacheService cacheService = new CacheServiceImpl(
getMemoryManager() );


    public static void init( int numberOfBuffers, int size, int
initialCapacity, int concurrencyLevel )
    {
        cacheService.init( numberOfBuffers, size, initialCapacity,
concurrencyLevel );
    }

    public static MemoryManagerService getMemoryManager()
    {
        return cacheService.getMemoryManager();
    }

This Cache class is a bit confuse IMHO.
What is the purpose of this class exactly ? it looks to duplicate
CacheServiceImpl.

I wonder about having like CacheFactory (or an other name) with a
DirectMemoryConfiguration class. I would prefer change the current
Cache class with that.

class DirectMemoryConfiguration {
  List<CacheRegion> cacheRegions;
}

class CacheRegion {
  String name;
  int numberOfBuffers;
  int size;
  int initialCapacity;
  int concurrencyLevel,
  String memoryManagerClazz; // optionnal
}

Basically this will instantiate a CacheServiceImpl per cacheRegion.

BTW after we can talk about a configuration file mechanism.

WDYT ?

Lemme if that makes sense for you.

-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

Re: chicken and eggs issue in Cache class (configuration mechanism)

Posted by "Raffaele P. Guidi" <ra...@gmail.com>.
Go ahead then: don't let good code go wasted :)

My +1

Ciao,
    R
Il giorno 21/feb/2012 21:02, "Simone Tripodi" <si...@apache.org> ha
scritto:

> Salut Olivier!
>
> I already proposed, some days ago - but looks like Daniel Manzke only
> took me seriously - an idea how to describe the configuration and the
> "factory".
>
> I invite you having a look at it if you didn't, because fits with what
> you described. Please see it on DIRECTMEMORY-62.
>
> Of course my proposal has to be enriched with regions, but I already
> have the impl on my machine.
>
> Simo
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
>
>
> On Tue, Feb 21, 2012 at 6:59 PM, Olivier Lamy <ol...@apache.org> wrote:
> > Currently Solr test failed due to a chicken and eggs issue.
> >
> >    private static CacheService cacheService = new CacheServiceImpl(
> > getMemoryManager() );
> >
> >
> >    public static void init( int numberOfBuffers, int size, int
> > initialCapacity, int concurrencyLevel )
> >    {
> >        cacheService.init( numberOfBuffers, size, initialCapacity,
> > concurrencyLevel );
> >    }
> >
> >    public static MemoryManagerService getMemoryManager()
> >    {
> >        return cacheService.getMemoryManager();
> >    }
> >
> > This Cache class is a bit confuse IMHO.
> > What is the purpose of this class exactly ? it looks to duplicate
> > CacheServiceImpl.
> >
> > I wonder about having like CacheFactory (or an other name) with a
> > DirectMemoryConfiguration class. I would prefer change the current
> > Cache class with that.
> >
> > class DirectMemoryConfiguration {
> >  List<CacheRegion> cacheRegions;
> > }
> >
> > class CacheRegion {
> >  String name;
> >  int numberOfBuffers;
> >  int size;
> >  int initialCapacity;
> >  int concurrencyLevel,
> >  String memoryManagerClazz; // optionnal
> > }
> >
> > Basically this will instantiate a CacheServiceImpl per cacheRegion.
> >
> > BTW after we can talk about a configuration file mechanism.
> >
> > WDYT ?
> >
> > Lemme if that makes sense for you.
> >
> > --
> > Olivier Lamy
> > Talend: http://coders.talend.com
> > http://twitter.com/olamy | http://linkedin.com/in/olamy
>

Re: chicken and eggs issue in Cache class (configuration mechanism)

Posted by Simone Tripodi <si...@apache.org>.
nice idea indeed :)

going to do work on it a while while working... :P

-Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/



On Wed, Feb 22, 2012 at 11:47 AM, Olivier Lamy <ol...@apache.org> wrote:
> why not share you changes in your github fork ?
> Will ease grab changes and test those.
>
> 2012/2/22 Simone Tripodi <si...@apache.org>:
>> Bonjour,
>>
>> +1 for 0.6.0-SNAPSHOT, we've changed enough things and maybe we'll
>> continue doing it - as next step, there are generics, see
>> DIRECTMEMORY-43
>>
>> -Simo
>>
>> http://people.apache.org/~simonetripodi/
>> http://simonetripodi.livejournal.com/
>> http://twitter.com/simonetripodi
>> http://www.99soft.org/
>>
>>
>>
>> On Wed, Feb 22, 2012 at 1:07 AM, Olivier Lamy <ol...@apache.org> wrote:
>>> Hello,
>>> Sorry I missed the thread.
>>> I should push it :-) we will discuss after.
>>>
>>> I'd like to be able to do something like myFactory (or an other name)
>>> .getRegion(name).put etc...
>>>
>>> BTW as we are introducing some changes what about bump version to
>>> 0.6.0-SNAPSHOT ?
>>>
>>> 2012/2/21 Simone Tripodi <si...@apache.org>:
>>>> Salut Olivier!
>>>>
>>>> I already proposed, some days ago - but looks like Daniel Manzke only
>>>> took me seriously - an idea how to describe the configuration and the
>>>> "factory".
>>>>
>>>> I invite you having a look at it if you didn't, because fits with what
>>>> you described. Please see it on DIRECTMEMORY-62.
>>>>
>>>> Of course my proposal has to be enriched with regions, but I already
>>>> have the impl on my machine.
>>>>
>>>> Simo
>>>>
>>>> http://people.apache.org/~simonetripodi/
>>>> http://simonetripodi.livejournal.com/
>>>> http://twitter.com/simonetripodi
>>>> http://www.99soft.org/
>>>>
>>>>
>>>>
>>>> On Tue, Feb 21, 2012 at 6:59 PM, Olivier Lamy <ol...@apache.org> wrote:
>>>>> Currently Solr test failed due to a chicken and eggs issue.
>>>>>
>>>>>    private static CacheService cacheService = new CacheServiceImpl(
>>>>> getMemoryManager() );
>>>>>
>>>>>
>>>>>    public static void init( int numberOfBuffers, int size, int
>>>>> initialCapacity, int concurrencyLevel )
>>>>>    {
>>>>>        cacheService.init( numberOfBuffers, size, initialCapacity,
>>>>> concurrencyLevel );
>>>>>    }
>>>>>
>>>>>    public static MemoryManagerService getMemoryManager()
>>>>>    {
>>>>>        return cacheService.getMemoryManager();
>>>>>    }
>>>>>
>>>>> This Cache class is a bit confuse IMHO.
>>>>> What is the purpose of this class exactly ? it looks to duplicate
>>>>> CacheServiceImpl.
>>>>>
>>>>> I wonder about having like CacheFactory (or an other name) with a
>>>>> DirectMemoryConfiguration class. I would prefer change the current
>>>>> Cache class with that.
>>>>>
>>>>> class DirectMemoryConfiguration {
>>>>>  List<CacheRegion> cacheRegions;
>>>>> }
>>>>>
>>>>> class CacheRegion {
>>>>>  String name;
>>>>>  int numberOfBuffers;
>>>>>  int size;
>>>>>  int initialCapacity;
>>>>>  int concurrencyLevel,
>>>>>  String memoryManagerClazz; // optionnal
>>>>> }
>>>>>
>>>>> Basically this will instantiate a CacheServiceImpl per cacheRegion.
>>>>>
>>>>> BTW after we can talk about a configuration file mechanism.
>>>>>
>>>>> WDYT ?
>>>>>
>>>>> Lemme if that makes sense for you.
>>>>>
>>>>> --
>>>>> Olivier Lamy
>>>>> Talend: http://coders.talend.com
>>>>> http://twitter.com/olamy | http://linkedin.com/in/olamy
>>>
>>>
>>>
>>> --
>>> Olivier Lamy
>>> Talend: http://coders.talend.com
>>> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
>
>
> --
> Olivier Lamy
> Talend: http://coders.talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy

Re: chicken and eggs issue in Cache class (configuration mechanism)

Posted by Olivier Lamy <ol...@apache.org>.
why not share you changes in your github fork ?
Will ease grab changes and test those.

2012/2/22 Simone Tripodi <si...@apache.org>:
> Bonjour,
>
> +1 for 0.6.0-SNAPSHOT, we've changed enough things and maybe we'll
> continue doing it - as next step, there are generics, see
> DIRECTMEMORY-43
>
> -Simo
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
>
>
> On Wed, Feb 22, 2012 at 1:07 AM, Olivier Lamy <ol...@apache.org> wrote:
>> Hello,
>> Sorry I missed the thread.
>> I should push it :-) we will discuss after.
>>
>> I'd like to be able to do something like myFactory (or an other name)
>> .getRegion(name).put etc...
>>
>> BTW as we are introducing some changes what about bump version to
>> 0.6.0-SNAPSHOT ?
>>
>> 2012/2/21 Simone Tripodi <si...@apache.org>:
>>> Salut Olivier!
>>>
>>> I already proposed, some days ago - but looks like Daniel Manzke only
>>> took me seriously - an idea how to describe the configuration and the
>>> "factory".
>>>
>>> I invite you having a look at it if you didn't, because fits with what
>>> you described. Please see it on DIRECTMEMORY-62.
>>>
>>> Of course my proposal has to be enriched with regions, but I already
>>> have the impl on my machine.
>>>
>>> Simo
>>>
>>> http://people.apache.org/~simonetripodi/
>>> http://simonetripodi.livejournal.com/
>>> http://twitter.com/simonetripodi
>>> http://www.99soft.org/
>>>
>>>
>>>
>>> On Tue, Feb 21, 2012 at 6:59 PM, Olivier Lamy <ol...@apache.org> wrote:
>>>> Currently Solr test failed due to a chicken and eggs issue.
>>>>
>>>>    private static CacheService cacheService = new CacheServiceImpl(
>>>> getMemoryManager() );
>>>>
>>>>
>>>>    public static void init( int numberOfBuffers, int size, int
>>>> initialCapacity, int concurrencyLevel )
>>>>    {
>>>>        cacheService.init( numberOfBuffers, size, initialCapacity,
>>>> concurrencyLevel );
>>>>    }
>>>>
>>>>    public static MemoryManagerService getMemoryManager()
>>>>    {
>>>>        return cacheService.getMemoryManager();
>>>>    }
>>>>
>>>> This Cache class is a bit confuse IMHO.
>>>> What is the purpose of this class exactly ? it looks to duplicate
>>>> CacheServiceImpl.
>>>>
>>>> I wonder about having like CacheFactory (or an other name) with a
>>>> DirectMemoryConfiguration class. I would prefer change the current
>>>> Cache class with that.
>>>>
>>>> class DirectMemoryConfiguration {
>>>>  List<CacheRegion> cacheRegions;
>>>> }
>>>>
>>>> class CacheRegion {
>>>>  String name;
>>>>  int numberOfBuffers;
>>>>  int size;
>>>>  int initialCapacity;
>>>>  int concurrencyLevel,
>>>>  String memoryManagerClazz; // optionnal
>>>> }
>>>>
>>>> Basically this will instantiate a CacheServiceImpl per cacheRegion.
>>>>
>>>> BTW after we can talk about a configuration file mechanism.
>>>>
>>>> WDYT ?
>>>>
>>>> Lemme if that makes sense for you.
>>>>
>>>> --
>>>> Olivier Lamy
>>>> Talend: http://coders.talend.com
>>>> http://twitter.com/olamy | http://linkedin.com/in/olamy
>>
>>
>>
>> --
>> Olivier Lamy
>> Talend: http://coders.talend.com
>> http://twitter.com/olamy | http://linkedin.com/in/olamy



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

Re: chicken and eggs issue in Cache class (configuration mechanism)

Posted by Simone Tripodi <si...@apache.org>.
Bonjour,

+1 for 0.6.0-SNAPSHOT, we've changed enough things and maybe we'll
continue doing it - as next step, there are generics, see
DIRECTMEMORY-43

-Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/



On Wed, Feb 22, 2012 at 1:07 AM, Olivier Lamy <ol...@apache.org> wrote:
> Hello,
> Sorry I missed the thread.
> I should push it :-) we will discuss after.
>
> I'd like to be able to do something like myFactory (or an other name)
> .getRegion(name).put etc...
>
> BTW as we are introducing some changes what about bump version to
> 0.6.0-SNAPSHOT ?
>
> 2012/2/21 Simone Tripodi <si...@apache.org>:
>> Salut Olivier!
>>
>> I already proposed, some days ago - but looks like Daniel Manzke only
>> took me seriously - an idea how to describe the configuration and the
>> "factory".
>>
>> I invite you having a look at it if you didn't, because fits with what
>> you described. Please see it on DIRECTMEMORY-62.
>>
>> Of course my proposal has to be enriched with regions, but I already
>> have the impl on my machine.
>>
>> Simo
>>
>> http://people.apache.org/~simonetripodi/
>> http://simonetripodi.livejournal.com/
>> http://twitter.com/simonetripodi
>> http://www.99soft.org/
>>
>>
>>
>> On Tue, Feb 21, 2012 at 6:59 PM, Olivier Lamy <ol...@apache.org> wrote:
>>> Currently Solr test failed due to a chicken and eggs issue.
>>>
>>>    private static CacheService cacheService = new CacheServiceImpl(
>>> getMemoryManager() );
>>>
>>>
>>>    public static void init( int numberOfBuffers, int size, int
>>> initialCapacity, int concurrencyLevel )
>>>    {
>>>        cacheService.init( numberOfBuffers, size, initialCapacity,
>>> concurrencyLevel );
>>>    }
>>>
>>>    public static MemoryManagerService getMemoryManager()
>>>    {
>>>        return cacheService.getMemoryManager();
>>>    }
>>>
>>> This Cache class is a bit confuse IMHO.
>>> What is the purpose of this class exactly ? it looks to duplicate
>>> CacheServiceImpl.
>>>
>>> I wonder about having like CacheFactory (or an other name) with a
>>> DirectMemoryConfiguration class. I would prefer change the current
>>> Cache class with that.
>>>
>>> class DirectMemoryConfiguration {
>>>  List<CacheRegion> cacheRegions;
>>> }
>>>
>>> class CacheRegion {
>>>  String name;
>>>  int numberOfBuffers;
>>>  int size;
>>>  int initialCapacity;
>>>  int concurrencyLevel,
>>>  String memoryManagerClazz; // optionnal
>>> }
>>>
>>> Basically this will instantiate a CacheServiceImpl per cacheRegion.
>>>
>>> BTW after we can talk about a configuration file mechanism.
>>>
>>> WDYT ?
>>>
>>> Lemme if that makes sense for you.
>>>
>>> --
>>> Olivier Lamy
>>> Talend: http://coders.talend.com
>>> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
>
>
> --
> Olivier Lamy
> Talend: http://coders.talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy

Re: chicken and eggs issue in Cache class (configuration mechanism)

Posted by Olivier Lamy <ol...@apache.org>.
Hello,
Sorry I missed the thread.
I should push it :-) we will discuss after.

I'd like to be able to do something like myFactory (or an other name)
.getRegion(name).put etc...

BTW as we are introducing some changes what about bump version to
0.6.0-SNAPSHOT ?

2012/2/21 Simone Tripodi <si...@apache.org>:
> Salut Olivier!
>
> I already proposed, some days ago - but looks like Daniel Manzke only
> took me seriously - an idea how to describe the configuration and the
> "factory".
>
> I invite you having a look at it if you didn't, because fits with what
> you described. Please see it on DIRECTMEMORY-62.
>
> Of course my proposal has to be enriched with regions, but I already
> have the impl on my machine.
>
> Simo
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
>
>
> On Tue, Feb 21, 2012 at 6:59 PM, Olivier Lamy <ol...@apache.org> wrote:
>> Currently Solr test failed due to a chicken and eggs issue.
>>
>>    private static CacheService cacheService = new CacheServiceImpl(
>> getMemoryManager() );
>>
>>
>>    public static void init( int numberOfBuffers, int size, int
>> initialCapacity, int concurrencyLevel )
>>    {
>>        cacheService.init( numberOfBuffers, size, initialCapacity,
>> concurrencyLevel );
>>    }
>>
>>    public static MemoryManagerService getMemoryManager()
>>    {
>>        return cacheService.getMemoryManager();
>>    }
>>
>> This Cache class is a bit confuse IMHO.
>> What is the purpose of this class exactly ? it looks to duplicate
>> CacheServiceImpl.
>>
>> I wonder about having like CacheFactory (or an other name) with a
>> DirectMemoryConfiguration class. I would prefer change the current
>> Cache class with that.
>>
>> class DirectMemoryConfiguration {
>>  List<CacheRegion> cacheRegions;
>> }
>>
>> class CacheRegion {
>>  String name;
>>  int numberOfBuffers;
>>  int size;
>>  int initialCapacity;
>>  int concurrencyLevel,
>>  String memoryManagerClazz; // optionnal
>> }
>>
>> Basically this will instantiate a CacheServiceImpl per cacheRegion.
>>
>> BTW after we can talk about a configuration file mechanism.
>>
>> WDYT ?
>>
>> Lemme if that makes sense for you.
>>
>> --
>> Olivier Lamy
>> Talend: http://coders.talend.com
>> http://twitter.com/olamy | http://linkedin.com/in/olamy



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

Re: chicken and eggs issue in Cache class (configuration mechanism)

Posted by Simone Tripodi <si...@apache.org>.
Salut Olivier!

I already proposed, some days ago - but looks like Daniel Manzke only
took me seriously - an idea how to describe the configuration and the
"factory".

I invite you having a look at it if you didn't, because fits with what
you described. Please see it on DIRECTMEMORY-62.

Of course my proposal has to be enriched with regions, but I already
have the impl on my machine.

Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/



On Tue, Feb 21, 2012 at 6:59 PM, Olivier Lamy <ol...@apache.org> wrote:
> Currently Solr test failed due to a chicken and eggs issue.
>
>    private static CacheService cacheService = new CacheServiceImpl(
> getMemoryManager() );
>
>
>    public static void init( int numberOfBuffers, int size, int
> initialCapacity, int concurrencyLevel )
>    {
>        cacheService.init( numberOfBuffers, size, initialCapacity,
> concurrencyLevel );
>    }
>
>    public static MemoryManagerService getMemoryManager()
>    {
>        return cacheService.getMemoryManager();
>    }
>
> This Cache class is a bit confuse IMHO.
> What is the purpose of this class exactly ? it looks to duplicate
> CacheServiceImpl.
>
> I wonder about having like CacheFactory (or an other name) with a
> DirectMemoryConfiguration class. I would prefer change the current
> Cache class with that.
>
> class DirectMemoryConfiguration {
>  List<CacheRegion> cacheRegions;
> }
>
> class CacheRegion {
>  String name;
>  int numberOfBuffers;
>  int size;
>  int initialCapacity;
>  int concurrencyLevel,
>  String memoryManagerClazz; // optionnal
> }
>
> Basically this will instantiate a CacheServiceImpl per cacheRegion.
>
> BTW after we can talk about a configuration file mechanism.
>
> WDYT ?
>
> Lemme if that makes sense for you.
>
> --
> Olivier Lamy
> Talend: http://coders.talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy