You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Ognen Duzlevski <og...@gmail.com> on 2015/04/20 05:46:08 UTC

Cache creation from multiple threads

I have a system of Akka actors that all extend a trait that goes on to
obtain an Ignite cache reference with the same name (in the example below
it is called "GenderCache"). In order to be safe, I am using
getOrCreateCache() which I believe will either create a cache or return a
reference to an existing one.

I am getting the error below when doing the above from multiple actors and
am not sure what exactly is going on. Is the error telling me that the
cache is in the process of being created while I am trying to issue another
getOrCreateCache() call with the same cache name? Or...?

My expectation would be that one of these calls would result in a cache
create operation and the rest would be just returning a reference.

Thanks!

Caused by: org.apache.ignite.cache.CacheExistsException: Failed to start
cache (a cache with the same name is already being started or stopped):
GenderCache
at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.initiateCacheChanges(GridCacheProcessor.java:1714)
at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.dynamicStartCache(GridCacheProcessor.java:1663)
at
org.apache.ignite.internal.IgniteKernal.getOrCreateCache(IgniteKernal.java:2289)
at
com.datascience.socialnetworkpollers.IgniteCacheInstance$.getOrCreateCache(Cacheable.scala:21)

Re: Cache creation from multiple threads

Posted by Ognen Duzlevski <og...@gmail.com>.
Never mind, dumb dumb me, figured it out, it is late, chalk this up to
that, I am talking gibberish ;)

On Sun, Apr 19, 2015 at 10:46 PM, Ognen Duzlevski <ognen.duzlevski@gmail.com
> wrote:

> I have a system of Akka actors that all extend a trait that goes on to
> obtain an Ignite cache reference with the same name (in the example below
> it is called "GenderCache"). In order to be safe, I am using
> getOrCreateCache() which I believe will either create a cache or return a
> reference to an existing one.
>
> I am getting the error below when doing the above from multiple actors and
> am not sure what exactly is going on. Is the error telling me that the
> cache is in the process of being created while I am trying to issue another
> getOrCreateCache() call with the same cache name? Or...?
>
> My expectation would be that one of these calls would result in a cache
> create operation and the rest would be just returning a reference.
>
> Thanks!
>
> Caused by: org.apache.ignite.cache.CacheExistsException: Failed to start
> cache (a cache with the same name is already being started or stopped):
> GenderCache
> at
> org.apache.ignite.internal.processors.cache.GridCacheProcessor.initiateCacheChanges(GridCacheProcessor.java:1714)
> at
> org.apache.ignite.internal.processors.cache.GridCacheProcessor.dynamicStartCache(GridCacheProcessor.java:1663)
> at
> org.apache.ignite.internal.IgniteKernal.getOrCreateCache(IgniteKernal.java:2289)
> at
> com.datascience.socialnetworkpollers.IgniteCacheInstance$.getOrCreateCache(Cacheable.scala:21)
>