You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Ira Vasilinets <iv...@gridgain.com> on 2015/03/23 16:18:59 UTC

Ignite.createCache semantic

Hi,

I have done ticket "Start caches with spring path":
https://issues.apache.org/jira/browse/IGNITE-556

I added for each method createCache(getOrCreateCache) pair method that use
xml file instead of CacheConfiguration.

Method createCache(String cacheXmlFile, String nearCacheXmlFile) conflicts
with createCache(@Nullable String cacheName, String nearCacheXmlFile).
I renamed second method to
createNearCache(@Nullable String cacheName, String nearCacheXmlFile)
and its paired method
createNearCache(@Nullable String cacheName, NearCacheConfiguration<K, V>
nearCfg).

I also renamed getOrCreateNearCache for the same reasons.

Thoughts?

Ira.

Re: Ignite.createCache semantic

Posted by Valentin Kulichenko <va...@gmail.com>.
Guys,

I think this solution is not very good from usability standpoint. It's a
common practice to have several cache configurations in one file and I
don't like that user will have to create a file per cache.

After offline discussion I implemented different way of doing the same
thing - added 'Ignition.loadSpringBean' method which is a generic way to
get a bean from Spring context by its name. It works for cache
configurations, near cache configurations, Ignite configurations and any
other beans configured via Spring (even not Ignite related). In addition it
allows to create a configuration template - you can set correct name and
make any modifications after loading it.

Please let me know if someone have any questions/thoughts.

--
Val

On Mon, Mar 23, 2015 at 10:25 PM, Ira Vasilinets <iv...@gridgain.com>
wrote:

> If file has several caches, method  will throw exception.
>
> вторник, 24 марта 2015 г. пользователь Dmitriy Setrakyan написал:
>
> > Ira,
> >
> > I have a question about this method:
> >
> >     public <K, V> IgniteCache<K, V> getOrCreateCache(String
> springCfgPath);
> >
> > If the configuration file has several caches defined, which one does this
> > method return?
> >
> > D.
> >
> > On Mon, Mar 23, 2015 at 9:06 AM, Ira Vasilinets <
> ivasilinets@gridgain.com
> > <javascript:;>>
> > wrote:
> >
> > > I merged it to ignite-45.
> > >
> > > On Mon, Mar 23, 2015 at 7:04 PM, Dmitriy Setrakyan <
> > dsetrakyan@apache.org <javascript:;>>
> > > wrote:
> > >
> > > > Thanks Ira!
> > > >
> > > > The approach sounds good to me. Are you merging it into sprint-2 or
> is
> > it
> > > > going to be done as part of sprint-3?
> > > >
> > > > D.
> > > >
> > > > On Mon, Mar 23, 2015 at 8:18 AM, Ira Vasilinets <
> > > ivasilinets@gridgain.com <javascript:;>>
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I have done ticket "Start caches with spring path":
> > > > > https://issues.apache.org/jira/browse/IGNITE-556
> > > > >
> > > > > I added for each method createCache(getOrCreateCache) pair method
> > that
> > > > use
> > > > > xml file instead of CacheConfiguration.
> > > > >
> > > > > Method createCache(String cacheXmlFile, String nearCacheXmlFile)
> > > > conflicts
> > > > > with createCache(@Nullable String cacheName, String
> > nearCacheXmlFile).
> > > > > I renamed second method to
> > > > > createNearCache(@Nullable String cacheName, String
> nearCacheXmlFile)
> > > > > and its paired method
> > > > > createNearCache(@Nullable String cacheName,
> NearCacheConfiguration<K,
> > > V>
> > > > > nearCfg).
> > > > >
> > > > > I also renamed getOrCreateNearCache for the same reasons.
> > > > >
> > > > > Thoughts?
> > > > >
> > > > > Ira.
> > > > >
> > > >
> > >
> >
>

Re: Ignite.createCache semantic

Posted by Ira Vasilinets <iv...@gridgain.com>.
If file has several caches, method  will throw exception.

вторник, 24 марта 2015 г. пользователь Dmitriy Setrakyan написал:

> Ira,
>
> I have a question about this method:
>
>     public <K, V> IgniteCache<K, V> getOrCreateCache(String springCfgPath);
>
> If the configuration file has several caches defined, which one does this
> method return?
>
> D.
>
> On Mon, Mar 23, 2015 at 9:06 AM, Ira Vasilinets <ivasilinets@gridgain.com
> <javascript:;>>
> wrote:
>
> > I merged it to ignite-45.
> >
> > On Mon, Mar 23, 2015 at 7:04 PM, Dmitriy Setrakyan <
> dsetrakyan@apache.org <javascript:;>>
> > wrote:
> >
> > > Thanks Ira!
> > >
> > > The approach sounds good to me. Are you merging it into sprint-2 or is
> it
> > > going to be done as part of sprint-3?
> > >
> > > D.
> > >
> > > On Mon, Mar 23, 2015 at 8:18 AM, Ira Vasilinets <
> > ivasilinets@gridgain.com <javascript:;>>
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > I have done ticket "Start caches with spring path":
> > > > https://issues.apache.org/jira/browse/IGNITE-556
> > > >
> > > > I added for each method createCache(getOrCreateCache) pair method
> that
> > > use
> > > > xml file instead of CacheConfiguration.
> > > >
> > > > Method createCache(String cacheXmlFile, String nearCacheXmlFile)
> > > conflicts
> > > > with createCache(@Nullable String cacheName, String
> nearCacheXmlFile).
> > > > I renamed second method to
> > > > createNearCache(@Nullable String cacheName, String nearCacheXmlFile)
> > > > and its paired method
> > > > createNearCache(@Nullable String cacheName, NearCacheConfiguration<K,
> > V>
> > > > nearCfg).
> > > >
> > > > I also renamed getOrCreateNearCache for the same reasons.
> > > >
> > > > Thoughts?
> > > >
> > > > Ira.
> > > >
> > >
> >
>

Re: Ignite.createCache semantic

Posted by Dmitriy Setrakyan <ds...@apache.org>.
Ira,

I have a question about this method:

    public <K, V> IgniteCache<K, V> getOrCreateCache(String springCfgPath);

If the configuration file has several caches defined, which one does this
method return?

D.

On Mon, Mar 23, 2015 at 9:06 AM, Ira Vasilinets <iv...@gridgain.com>
wrote:

> I merged it to ignite-45.
>
> On Mon, Mar 23, 2015 at 7:04 PM, Dmitriy Setrakyan <ds...@apache.org>
> wrote:
>
> > Thanks Ira!
> >
> > The approach sounds good to me. Are you merging it into sprint-2 or is it
> > going to be done as part of sprint-3?
> >
> > D.
> >
> > On Mon, Mar 23, 2015 at 8:18 AM, Ira Vasilinets <
> ivasilinets@gridgain.com>
> > wrote:
> >
> > > Hi,
> > >
> > > I have done ticket "Start caches with spring path":
> > > https://issues.apache.org/jira/browse/IGNITE-556
> > >
> > > I added for each method createCache(getOrCreateCache) pair method that
> > use
> > > xml file instead of CacheConfiguration.
> > >
> > > Method createCache(String cacheXmlFile, String nearCacheXmlFile)
> > conflicts
> > > with createCache(@Nullable String cacheName, String nearCacheXmlFile).
> > > I renamed second method to
> > > createNearCache(@Nullable String cacheName, String nearCacheXmlFile)
> > > and its paired method
> > > createNearCache(@Nullable String cacheName, NearCacheConfiguration<K,
> V>
> > > nearCfg).
> > >
> > > I also renamed getOrCreateNearCache for the same reasons.
> > >
> > > Thoughts?
> > >
> > > Ira.
> > >
> >
>

Re: Ignite.createCache semantic

Posted by Ira Vasilinets <iv...@gridgain.com>.
I merged it to ignite-45.

On Mon, Mar 23, 2015 at 7:04 PM, Dmitriy Setrakyan <ds...@apache.org>
wrote:

> Thanks Ira!
>
> The approach sounds good to me. Are you merging it into sprint-2 or is it
> going to be done as part of sprint-3?
>
> D.
>
> On Mon, Mar 23, 2015 at 8:18 AM, Ira Vasilinets <iv...@gridgain.com>
> wrote:
>
> > Hi,
> >
> > I have done ticket "Start caches with spring path":
> > https://issues.apache.org/jira/browse/IGNITE-556
> >
> > I added for each method createCache(getOrCreateCache) pair method that
> use
> > xml file instead of CacheConfiguration.
> >
> > Method createCache(String cacheXmlFile, String nearCacheXmlFile)
> conflicts
> > with createCache(@Nullable String cacheName, String nearCacheXmlFile).
> > I renamed second method to
> > createNearCache(@Nullable String cacheName, String nearCacheXmlFile)
> > and its paired method
> > createNearCache(@Nullable String cacheName, NearCacheConfiguration<K, V>
> > nearCfg).
> >
> > I also renamed getOrCreateNearCache for the same reasons.
> >
> > Thoughts?
> >
> > Ira.
> >
>

Re: Ignite.createCache semantic

Posted by Dmitriy Setrakyan <ds...@apache.org>.
Thanks Ira!

The approach sounds good to me. Are you merging it into sprint-2 or is it
going to be done as part of sprint-3?

D.

On Mon, Mar 23, 2015 at 8:18 AM, Ira Vasilinets <iv...@gridgain.com>
wrote:

> Hi,
>
> I have done ticket "Start caches with spring path":
> https://issues.apache.org/jira/browse/IGNITE-556
>
> I added for each method createCache(getOrCreateCache) pair method that use
> xml file instead of CacheConfiguration.
>
> Method createCache(String cacheXmlFile, String nearCacheXmlFile) conflicts
> with createCache(@Nullable String cacheName, String nearCacheXmlFile).
> I renamed second method to
> createNearCache(@Nullable String cacheName, String nearCacheXmlFile)
> and its paired method
> createNearCache(@Nullable String cacheName, NearCacheConfiguration<K, V>
> nearCfg).
>
> I also renamed getOrCreateNearCache for the same reasons.
>
> Thoughts?
>
> Ira.
>