[jira] [Commented] (IGNITE-5030) Support Spring @Cacheable(sync=true) annotation

2017-06-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16066776#comment-16066776
 ] 

ASF GitHub Bot commented on IGNITE-5030:


Github user mcherkasov closed the pull request at:

https://github.com/apache/ignite/pull/2030


> Support Spring @Cacheable(sync=true) annotation
> ---
>
> Key: IGNITE-5030
> URL: https://issues.apache.org/jira/browse/IGNITE-5030
> Project: Ignite
>  Issue Type: Task
>Reporter: Anton Vinogradov
>Assignee: Mikhail Cherkasov
> Fix For: 2.1
>
>
> @Cacheable(sync=true) guarantee that only one thread (across the cluster) 
> will fetch value for a key on get, even in case of some simultaneous gets.
> So, 
> org.apache.ignite.cache.spring.SpringCache#get(java.lang.Object, 
> java.util.concurrent.Callable) 
> should be implemented to provide such guarantee.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-5030) Support Spring @Cacheable(sync=true) annotation

2017-05-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16028604#comment-16028604
 ] 

ASF GitHub Bot commented on IGNITE-5030:


GitHub user mcherkasov opened a pull request:

https://github.com/apache/ignite/pull/2030

IGNITE-5030 Support Spring @Cacheable(sync=true) annotation



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/gridgain/apache-ignite IGNITE-5030

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/ignite/pull/2030.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2030


commit 37ae9bf51aa68a17a41199df6c41897fda1c7cd3
Author: mcherkasov 
Date:   2017-05-29T17:29:28Z

Added support for sync option in @Cacheable annotation




> Support Spring @Cacheable(sync=true) annotation
> ---
>
> Key: IGNITE-5030
> URL: https://issues.apache.org/jira/browse/IGNITE-5030
> Project: Ignite
>  Issue Type: Task
>Reporter: Anton Vinogradov
>Assignee: Mikhail Cherkasov
>
> @Cacheable(sync=true) guarantee that only one thread (across the cluster) 
> will fetch value for a key on get, even in case of some simultaneous gets.
> So, 
> org.apache.ignite.cache.spring.SpringCache#get(java.lang.Object, 
> java.util.concurrent.Callable) 
> should be implemented to provide such guarantee.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-5030) Support Spring @Cacheable(sync=true) annotation

2017-05-02 Thread Vyacheslav Daradur (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15992930#comment-15992930
 ] 

Vyacheslav Daradur commented on IGNITE-5030:


[~avinogradov]

It was just a prototype for solutions assessment.
Thanks for the advise, that's what I'll do.

> Support Spring @Cacheable(sync=true) annotation
> ---
>
> Key: IGNITE-5030
> URL: https://issues.apache.org/jira/browse/IGNITE-5030
> Project: Ignite
>  Issue Type: Task
>Reporter: Anton Vinogradov
>
> @Cacheable(sync=true) guarantee that only one thread (across the cluster) 
> will fetch value for a key on get, even in case of some simultaneous gets.
> So, 
> org.apache.ignite.cache.spring.SpringCache#get(java.lang.Object, 
> java.util.concurrent.Callable) 
> should be implemented to provide such guarantee.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-5030) Support Spring @Cacheable(sync=true) annotation

2017-05-02 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15992895#comment-15992895
 ] 

ASF GitHub Bot commented on IGNITE-5030:


Github user daradurvs closed the pull request at:

https://github.com/apache/ignite/pull/1852


> Support Spring @Cacheable(sync=true) annotation
> ---
>
> Key: IGNITE-5030
> URL: https://issues.apache.org/jira/browse/IGNITE-5030
> Project: Ignite
>  Issue Type: Task
>Reporter: Anton Vinogradov
>
> @Cacheable(sync=true) guarantee that only one thread (across the cluster) 
> will fetch value for a key on get, even in case of some simultaneous gets.
> So, 
> org.apache.ignite.cache.spring.SpringCache#get(java.lang.Object, 
> java.util.concurrent.Callable) 
> should be implemented to provide such guarantee.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-5030) Support Spring @Cacheable(sync=true) annotation

2017-05-02 Thread Anton Vinogradov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15992754#comment-15992754
 ] 

Anton Vinogradov commented on IGNITE-5030:
--

[~daradurvs]

Sorry for delay, I caught a cold and was unable to review PR. 
Thank's for desire to solve this issue, but code you provided can't be accepted.
Seems, this task require some years of experience with distributed systems and 
concurrency.
I'd like to propose you to chose some easier tasks to gain such experience.

> Support Spring @Cacheable(sync=true) annotation
> ---
>
> Key: IGNITE-5030
> URL: https://issues.apache.org/jira/browse/IGNITE-5030
> Project: Ignite
>  Issue Type: Task
>Reporter: Anton Vinogradov
>Assignee: Vyacheslav Daradur
>
> @Cacheable(sync=true) guarantee that only one thread (across the cluster) 
> will fetch value for a key on get, even in case of some simultaneous gets.
> So, 
> org.apache.ignite.cache.spring.SpringCache#get(java.lang.Object, 
> java.util.concurrent.Callable) 
> should be implemented to provide such guarantee.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-5030) Support Spring @Cacheable(sync=true) annotation

2017-04-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15978466#comment-15978466
 ] 

ASF GitHub Bot commented on IGNITE-5030:


GitHub user daradurvs opened a pull request:

https://github.com/apache/ignite/pull/1852

IGNITE-5030



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/daradurvs/ignite ignite-5030

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/ignite/pull/1852.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1852


commit 958749be996e531a05fa5afd284aadd9e9838359
Author: Vyacheslav Daradur 
Date:   2017-04-21T10:28:56Z

ignite-5030: the method was implemented




> Support Spring @Cacheable(sync=true) annotation
> ---
>
> Key: IGNITE-5030
> URL: https://issues.apache.org/jira/browse/IGNITE-5030
> Project: Ignite
>  Issue Type: Task
>Reporter: Anton Vinogradov
>Assignee: Vyacheslav Daradur
>
> @Cacheable(sync=true) guarantee that only one thread (across the cluster) 
> will fetch value for a key on get, even in case of some simultaneous gets.
> So, 
> org.apache.ignite.cache.spring.SpringCache#get(java.lang.Object, 
> java.util.concurrent.Callable) 
> should be implemented to provide such guarantee.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-5030) Support Spring @Cacheable(sync=true) annotation

2017-04-21 Thread Vyacheslav Daradur (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15978489#comment-15978489
 ] 

Vyacheslav Daradur commented on IGNITE-5030:


Sent to [ci.tests|http://ci.ignite.apache.org/viewQueued.html?itemId=576060]

[~avinogradov], If you have a time, please, take a look at the current solution.

> Support Spring @Cacheable(sync=true) annotation
> ---
>
> Key: IGNITE-5030
> URL: https://issues.apache.org/jira/browse/IGNITE-5030
> Project: Ignite
>  Issue Type: Task
>Reporter: Anton Vinogradov
>Assignee: Vyacheslav Daradur
>
> @Cacheable(sync=true) guarantee that only one thread (across the cluster) 
> will fetch value for a key on get, even in case of some simultaneous gets.
> So, 
> org.apache.ignite.cache.spring.SpringCache#get(java.lang.Object, 
> java.util.concurrent.Callable) 
> should be implemented to provide such guarantee.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-5030) Support Spring @Cacheable(sync=true) annotation

2017-04-21 Thread Vyacheslav Daradur (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15978260#comment-15978260
 ] 

Vyacheslav Daradur commented on IGNITE-5030:


bq. @Cacheable(sync=true) guarantee that only one thread (across the cluster) 
will fetch value for a key on get, even in case of some simultaneous gets.
The main idea is using EntryProcessor to provide such guarantee.
{code}
IgniteCache#invoke(K key, EntryProcessor entryProcessor, Object... 
arguments)
{code}
It works well when we call #invoke directly.
But, there is an issue when using @Cachable(sync = true) with a cluster with 2+ 
nodes.

The main reason of the issue is that "args0" (in the code below) is an instance 
of CacheAspectSupport$1, 
which  can't be deserialized properly at another node after a transfering, 
because it contains classes wich are generated runtime by JVM.
{code}
class ValueLoaderEntryProcessor implements CacheEntryProcessor {
@Override public T process(MutableEntry entry, 
Object... args) throws EntryProcessorException {

 Callable valueLoader = (Callable)args[0];

// working logic according to the documentations
}
}
{code}

Another solutions is using a lock on a key, for example:
{code}
@Override public  T get(Object key, Callable valueLoader) {
Object val = cache.get(key);

if (val != null)
return (T)fromStoreValue(val);

Lock lock = cache.lock(key);
try {
lock.lock();

try {
val = valueLoader.call();
}
catch (Exception e) {
throw new ValueRetrievalException(key, valueLoader, e);
}

if (val != null)
cache.put(key, val);
}
finally {
lock.unlock();
}
}
{code}
But it works only with TRANSACTIONAL atomicity mode.

> Support Spring @Cacheable(sync=true) annotation
> ---
>
> Key: IGNITE-5030
> URL: https://issues.apache.org/jira/browse/IGNITE-5030
> Project: Ignite
>  Issue Type: Task
>Reporter: Anton Vinogradov
>Assignee: Vyacheslav Daradur
>
> @Cacheable(sync=true) guarantee that only one thread (across the cluster) 
> will fetch value for a key on get, even in case of some simultaneous gets.
> So, 
> org.apache.ignite.cache.spring.SpringCache#get(java.lang.Object, 
> java.util.concurrent.Callable) 
> should be implemented to provide such guarantee.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-5030) Support Spring @Cacheable(sync=true) annotation

2017-04-19 Thread Anton Vinogradov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15974630#comment-15974630
 ] 

Anton Vinogradov commented on IGNITE-5030:
--

Initial discussion can be found at IGNITE-4211

> Support Spring @Cacheable(sync=true) annotation
> ---
>
> Key: IGNITE-5030
> URL: https://issues.apache.org/jira/browse/IGNITE-5030
> Project: Ignite
>  Issue Type: Task
>Reporter: Anton Vinogradov
>
> @Cacheable(sync=true) guarantee that only one thread (across the cluster) 
> will fetch value for a key on get, even in case of some simultaneous gets.
> So, 
> org.apache.ignite.cache.spring.SpringCache#get(java.lang.Object, 
> java.util.concurrent.Callable) 
> should be implemented to provide such guarantee.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)