You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Do...@ODDO, od...@gmail.com on 2016/01/27 18:13:54 UTC

affinityRun() and affinityCall() (JIRA ticket)

Hello,

I am playing with https://issues.apache.org/jira/browse/IGNITE-1144 as 
introduction to hacking on Ignite. I am not a Java developer by day but 
have experience writing code in various languages. This is my first 
in-depth exposure to Ignite internals (have lightly used it as a user in 
a POC project).

Looking at this ticket, I am guessing that what it needs to do is get 
the cache name from the kernel context. After that it can just pass on 
the call (such as affinityRun()) to the regular affinityRun() call with 
the cache name filled in as the first parameter. This is because an 
internal (un-exposed) cache is used to track the queue/set data 
structures. Is this all correct?

My question is: how do I get the cache name from within the queue 
implementation.

Thanks!




Re: affinityRun() and affinityCall() (JIRA ticket)

Posted by Valentin Kulichenko <va...@gmail.com>.
Hi!

I looked through your latest pull request and left several comments on the
ticket.

-Val

On Fri, Jan 29, 2016 at 8:56 PM, Valentin Kulichenko <
valentin.kulichenko@gmail.com> wrote:

> Responded in the ticket.
>
> -Val
>
> On Fri, Jan 29, 2016 at 7:05 AM, Dood@ODDO <od...@gmail.com> wrote:
>
>> Val,
>>
>> Before I go on and submit pull requests etc. - would you comment on the
>> path I am taking with this? As I said I am not a JAVA developer but I am
>> trying to teach myself the language and contribute at the same time ;)
>>
>> Here are my thoughts on implementing this for the queue
>> (GridCacheQueueAdapter.java). I have also declared the following in
>> IgniteQueue.java:
>>
>> @IgniteAsyncSupported
>> public void affinityRun(IgniteRunnable job) throws IgniteException;
>>
>> @IgniteAsyncSupported
>> public <R> R affinityCall(IgniteCallable<R> job) throws IgniteException;
>>
>> Here is what is in GridCacheQueueAdapter.java
>>
>> /** {@inheritDoc} */
>> public void affinityRun(IgniteRunnable job) {
>> if (!collocated)
>> throw new IgniteException("Illegal operation requested on non-collocated
>> queue:affinityRun().");
>>
>> try {
>> compute.affinityRun(cache.name(),queueKey,job);
>> }
>> catch (IgniteException e) {
>> throw e;
>> }
>> }
>>
>> /** {@inheritDoc} */
>> public <R> R affinityCall(IgniteCallable<R> job) {
>> if (!collocated)
>> throw new IgniteException("Illegal operation requested on non-collocated
>> queue:affinityCall().");
>>
>> try {
>> return compute.affinityCall(cache.name(),queueKey,job);
>> }
>> catch (IgniteException e) {
>> throw e;
>> }
>> }
>>
>> I have included the following at the top of the class
>> GridCacheQueueAdapter:
>> private final IgniteCompute compute;
>>
>> this.compute = cctx.kernalContext().grid().compute();
>>
>> Let me know what you think!
>>
>>
>> On 1/27/2016 3:55 PM, Valentin Kulichenko wrote:
>>
>>> Hi,
>>>
>>> Both GridCacheQueueAdapter and GridCacheSetImpl have a reference to
>>> GridCacheContext which represents the underlying cache for the data
>>> structure. GridCacheContext.name() will give you the correct cache name
>>> that you can use when calling affinityRun method.
>>>
>>> -Val
>>>
>>> On Wed, Jan 27, 2016 at 9:13 AM, Dood@ODDO <od...@gmail.com> wrote:
>>>
>>> Hello,
>>>>
>>>> I am playing with https://issues.apache.org/jira/browse/IGNITE-1144 as
>>>> introduction to hacking on Ignite. I am not a Java developer by day but
>>>> have experience writing code in various languages. This is my first
>>>> in-depth exposure to Ignite internals (have lightly used it as a user
>>>> in a
>>>> POC project).
>>>>
>>>> Looking at this ticket, I am guessing that what it needs to do is get
>>>> the
>>>> cache name from the kernel context. After that it can just pass on the
>>>> call
>>>> (such as affinityRun()) to the regular affinityRun() call with the cache
>>>> name filled in as the first parameter. This is because an internal
>>>> (un-exposed) cache is used to track the queue/set data structures. Is
>>>> this
>>>> all correct?
>>>>
>>>> My question is: how do I get the cache name from within the queue
>>>> implementation.
>>>>
>>>> Thanks!
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>

Re: affinityRun() and affinityCall() (JIRA ticket)

Posted by Valentin Kulichenko <va...@gmail.com>.
Responded in the ticket.

-Val

On Fri, Jan 29, 2016 at 7:05 AM, Dood@ODDO <od...@gmail.com> wrote:

> Val,
>
> Before I go on and submit pull requests etc. - would you comment on the
> path I am taking with this? As I said I am not a JAVA developer but I am
> trying to teach myself the language and contribute at the same time ;)
>
> Here are my thoughts on implementing this for the queue
> (GridCacheQueueAdapter.java). I have also declared the following in
> IgniteQueue.java:
>
> @IgniteAsyncSupported
> public void affinityRun(IgniteRunnable job) throws IgniteException;
>
> @IgniteAsyncSupported
> public <R> R affinityCall(IgniteCallable<R> job) throws IgniteException;
>
> Here is what is in GridCacheQueueAdapter.java
>
> /** {@inheritDoc} */
> public void affinityRun(IgniteRunnable job) {
> if (!collocated)
> throw new IgniteException("Illegal operation requested on non-collocated
> queue:affinityRun().");
>
> try {
> compute.affinityRun(cache.name(),queueKey,job);
> }
> catch (IgniteException e) {
> throw e;
> }
> }
>
> /** {@inheritDoc} */
> public <R> R affinityCall(IgniteCallable<R> job) {
> if (!collocated)
> throw new IgniteException("Illegal operation requested on non-collocated
> queue:affinityCall().");
>
> try {
> return compute.affinityCall(cache.name(),queueKey,job);
> }
> catch (IgniteException e) {
> throw e;
> }
> }
>
> I have included the following at the top of the class
> GridCacheQueueAdapter:
> private final IgniteCompute compute;
>
> this.compute = cctx.kernalContext().grid().compute();
>
> Let me know what you think!
>
>
> On 1/27/2016 3:55 PM, Valentin Kulichenko wrote:
>
>> Hi,
>>
>> Both GridCacheQueueAdapter and GridCacheSetImpl have a reference to
>> GridCacheContext which represents the underlying cache for the data
>> structure. GridCacheContext.name() will give you the correct cache name
>> that you can use when calling affinityRun method.
>>
>> -Val
>>
>> On Wed, Jan 27, 2016 at 9:13 AM, Dood@ODDO <od...@gmail.com> wrote:
>>
>> Hello,
>>>
>>> I am playing with https://issues.apache.org/jira/browse/IGNITE-1144 as
>>> introduction to hacking on Ignite. I am not a Java developer by day but
>>> have experience writing code in various languages. This is my first
>>> in-depth exposure to Ignite internals (have lightly used it as a user in
>>> a
>>> POC project).
>>>
>>> Looking at this ticket, I am guessing that what it needs to do is get the
>>> cache name from the kernel context. After that it can just pass on the
>>> call
>>> (such as affinityRun()) to the regular affinityRun() call with the cache
>>> name filled in as the first parameter. This is because an internal
>>> (un-exposed) cache is used to track the queue/set data structures. Is
>>> this
>>> all correct?
>>>
>>> My question is: how do I get the cache name from within the queue
>>> implementation.
>>>
>>> Thanks!
>>>
>>>
>>>
>>>
>>>
>

Re: affinityRun() and affinityCall() (JIRA ticket)

Posted by Do...@ODDO, od...@gmail.com.
Val,

Before I go on and submit pull requests etc. - would you comment on the 
path I am taking with this? As I said I am not a JAVA developer but I am 
trying to teach myself the language and contribute at the same time ;)

Here are my thoughts on implementing this for the queue 
(GridCacheQueueAdapter.java). I have also declared the following in 
IgniteQueue.java:

@IgniteAsyncSupported
public void affinityRun(IgniteRunnable job) throws IgniteException;

@IgniteAsyncSupported
public <R> R affinityCall(IgniteCallable<R> job) throws IgniteException;

Here is what is in GridCacheQueueAdapter.java

/** {@inheritDoc} */
public void affinityRun(IgniteRunnable job) {
if (!collocated)
throw new IgniteException("Illegal operation requested on non-collocated 
queue:affinityRun().");

try {
compute.affinityRun(cache.name(),queueKey,job);
}
catch (IgniteException e) {
throw e;
}
}

/** {@inheritDoc} */
public <R> R affinityCall(IgniteCallable<R> job) {
if (!collocated)
throw new IgniteException("Illegal operation requested on non-collocated 
queue:affinityCall().");

try {
return compute.affinityCall(cache.name(),queueKey,job);
}
catch (IgniteException e) {
throw e;
}
}

I have included the following at the top of the class 
GridCacheQueueAdapter:
private final IgniteCompute compute;

this.compute = cctx.kernalContext().grid().compute();

Let me know what you think!

On 1/27/2016 3:55 PM, Valentin Kulichenko wrote:
> Hi,
>
> Both GridCacheQueueAdapter and GridCacheSetImpl have a reference to
> GridCacheContext which represents the underlying cache for the data
> structure. GridCacheContext.name() will give you the correct cache name
> that you can use when calling affinityRun method.
>
> -Val
>
> On Wed, Jan 27, 2016 at 9:13 AM, Dood@ODDO <od...@gmail.com> wrote:
>
>> Hello,
>>
>> I am playing with https://issues.apache.org/jira/browse/IGNITE-1144 as
>> introduction to hacking on Ignite. I am not a Java developer by day but
>> have experience writing code in various languages. This is my first
>> in-depth exposure to Ignite internals (have lightly used it as a user in a
>> POC project).
>>
>> Looking at this ticket, I am guessing that what it needs to do is get the
>> cache name from the kernel context. After that it can just pass on the call
>> (such as affinityRun()) to the regular affinityRun() call with the cache
>> name filled in as the first parameter. This is because an internal
>> (un-exposed) cache is used to track the queue/set data structures. Is this
>> all correct?
>>
>> My question is: how do I get the cache name from within the queue
>> implementation.
>>
>> Thanks!
>>
>>
>>
>>


Re: affinityRun() and affinityCall() (JIRA ticket)

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

Both GridCacheQueueAdapter and GridCacheSetImpl have a reference to
GridCacheContext which represents the underlying cache for the data
structure. GridCacheContext.name() will give you the correct cache name
that you can use when calling affinityRun method.

-Val

On Wed, Jan 27, 2016 at 9:13 AM, Dood@ODDO <od...@gmail.com> wrote:

> Hello,
>
> I am playing with https://issues.apache.org/jira/browse/IGNITE-1144 as
> introduction to hacking on Ignite. I am not a Java developer by day but
> have experience writing code in various languages. This is my first
> in-depth exposure to Ignite internals (have lightly used it as a user in a
> POC project).
>
> Looking at this ticket, I am guessing that what it needs to do is get the
> cache name from the kernel context. After that it can just pass on the call
> (such as affinityRun()) to the regular affinityRun() call with the cache
> name filled in as the first parameter. This is because an internal
> (un-exposed) cache is used to track the queue/set data structures. Is this
> all correct?
>
> My question is: how do I get the cache name from within the queue
> implementation.
>
> Thanks!
>
>
>
>

Re: affinityRun() and affinityCall() (JIRA ticket)

Posted by Dmitriy Setrakyan <ds...@apache.org>.
On Wed, Jan 27, 2016 at 5:48 PM, Dmitriy Setrakyan <ds...@apache.org>
wrote:

>
>
> On Wed, Jan 27, 2016 at 4:36 PM, Dood@ODDO <od...@gmail.com> wrote:
>
>> On 1/27/2016 5:33 PM, Dmitriy Setrakyan wrote:
>>
>>> Hi,
>>>
>>> We should assign the ticket to you. Can you please send your Jira
>>> username
>>> here (you can create one)? This way I will add you to a list of Ignite
>>> contributors in Jira and assign the ticket to you.
>>>
>>> D.
>>>
>>
>> Dmitriy, username is "maketo". Thanks!
>>
>
> Apache Jira is telling me that there is no such user. Did you create an
> account?
>

Worked now. The ticket is assigned to you.

Re: affinityRun() and affinityCall() (JIRA ticket)

Posted by Dmitriy Setrakyan <ds...@apache.org>.
On Wed, Jan 27, 2016 at 4:36 PM, Dood@ODDO <od...@gmail.com> wrote:

> On 1/27/2016 5:33 PM, Dmitriy Setrakyan wrote:
>
>> Hi,
>>
>> We should assign the ticket to you. Can you please send your Jira username
>> here (you can create one)? This way I will add you to a list of Ignite
>> contributors in Jira and assign the ticket to you.
>>
>> D.
>>
>
> Dmitriy, username is "maketo". Thanks!
>

Apache Jira is telling me that there is no such user. Did you create an
account?

Re: affinityRun() and affinityCall() (JIRA ticket)

Posted by Do...@ODDO, od...@gmail.com.
On 1/27/2016 5:33 PM, Dmitriy Setrakyan wrote:
> Hi,
>
> We should assign the ticket to you. Can you please send your Jira username
> here (you can create one)? This way I will add you to a list of Ignite
> contributors in Jira and assign the ticket to you.
>
> D.

Dmitriy, username is "maketo". Thanks!


Re: affinityRun() and affinityCall() (JIRA ticket)

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

We should assign the ticket to you. Can you please send your Jira username
here (you can create one)? This way I will add you to a list of Ignite
contributors in Jira and assign the ticket to you.

D.

On Wed, Jan 27, 2016 at 9:13 AM, Dood@ODDO <od...@gmail.com> wrote:

> Hello,
>
> I am playing with https://issues.apache.org/jira/browse/IGNITE-1144 as
> introduction to hacking on Ignite. I am not a Java developer by day but
> have experience writing code in various languages. This is my first
> in-depth exposure to Ignite internals (have lightly used it as a user in a
> POC project).
>
> Looking at this ticket, I am guessing that what it needs to do is get the
> cache name from the kernel context. After that it can just pass on the call
> (such as affinityRun()) to the regular affinityRun() call with the cache
> name filled in as the first parameter. This is because an internal
> (un-exposed) cache is used to track the queue/set data structures. Is this
> all correct?
>
> My question is: how do I get the cache name from within the queue
> implementation.
>
> Thanks!
>
>
>
>