[jira] [Commented] (IGNITE-638) Implement IgniteSemaphore data structure

2016-07-18 Thread Krome Plasma (JIRA)

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

Krome Plasma commented on IGNITE-638:
-

Have a question, why not support a fair semaphore option ? It would be useful 
when trying to acquire all permits for write lock behavior and have multiple 
writers on multiple nodes.

> Implement IgniteSemaphore data structure
> 
>
> Key: IGNITE-638
> URL: https://issues.apache.org/jira/browse/IGNITE-638
> Project: Ignite
>  Issue Type: Sub-task
>  Components: data structures
>Reporter: Dmitriy Setrakyan
>Assignee: Denis Magda
>  Labels: features, newbie
> Fix For: 1.5.0.final
>
>
> We need to add {{IgniteSemaphore}} data structure in addition to other data 
> structures provided by Ignite. {{IgniteSemaphore}} should have similar API to 
> {{java.util.concurrent.IgniteSemaphore}} class in JDK.
> As an example, you can see how 
> [IgniteCountDownLatch|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java]
>  is implemented in 
> [GridCacheCountDownLatchImpl|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java]
>  class.
> In general we need to have an entity in ATOMIC cache storing number of 
> permits and allow user threads to block whenever no more permits are 
> available.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-638) Implement IgniteSemaphore data structure

2015-11-20 Thread Denis Magda (JIRA)

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

Denis Magda commented on IGNITE-638:


Merged the changes into 1.5 branch.

Vladislav, thanks a lot for such a big contribution!

> Implement IgniteSemaphore data structure
> 
>
> Key: IGNITE-638
> URL: https://issues.apache.org/jira/browse/IGNITE-638
> Project: Ignite
>  Issue Type: Sub-task
>  Components: data structures
>Reporter: Dmitriy Setrakyan
>Assignee: Denis Magda
>  Labels: features, newbie
> Fix For: 1.5
>
>
> We need to add {{IgniteSemaphore}} data structure in addition to other data 
> structures provided by Ignite. {{IgniteSemaphore}} should have similar API to 
> {{java.util.concurrent.IgniteSemaphore}} class in JDK.
> As an example, you can see how 
> [IgniteCountDownLatch|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java]
>  is implemented in 
> [GridCacheCountDownLatchImpl|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java]
>  class.
> In general we need to have an entity in ATOMIC cache storing number of 
> permits and allow user threads to block whenever no more permits are 
> available.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-638) Implement IgniteSemaphore data structure

2015-11-02 Thread Yakov Zhdanov (JIRA)

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

Yakov Zhdanov commented on IGNITE-638:
--

Vlad,

1. Agree, we can remove getQueueLength() or change its semantics to return 
nodes count.
7. I like the idea with failoverSafe. Solution for exception is - what if we 
act as CyclicBarrier with its BrokenBarrierException?

Thanks!

> Implement IgniteSemaphore data structure
> 
>
> Key: IGNITE-638
> URL: https://issues.apache.org/jira/browse/IGNITE-638
> Project: Ignite
>  Issue Type: Sub-task
>  Components: data structures
>Affects Versions: sprint-9
>Reporter: Dmitriy Setrakyan
>Assignee: Vladisav Jelisavcic
>  Labels: features, newbie
> Fix For: 1.5
>
>
> We need to add {{IgniteSemaphore}} data structure in addition to other data 
> structures provided by Ignite. {{IgniteSemaphore}} should have similar API to 
> {{java.util.concurrent.IgniteSemaphore}} class in JDK.
> As an example, you can see how 
> [IgniteCountDownLatch|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java]
>  is implemented in 
> [GridCacheCountDownLatchImpl|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java]
>  class.
> In general we need to have an entity in ATOMIC cache storing number of 
> permits and allow user threads to block whenever no more permits are 
> available.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-638) Implement IgniteSemaphore data structure

2015-10-23 Thread Yakov Zhdanov (JIRA)

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

Yakov Zhdanov commented on IGNITE-638:
--

Vlad,

Great job! I reviewed the code and I really liked it!

Couple of points though:

# I think we can should without 
org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreImpl.Sync#threadMap.
 We need a bit another approach. Why do I need to increment waiters (globally 
in cache) for each thread in local JVM? Can we use JVM as a waiter and not to 
update global object for each thread? I think this can save a lot of cache 
operations.
# Please add failover tests - if they fail we can always disable them unless 
fixed.
# Please add tests for example you have added. See IgniteExamplesSelfTestSuite.
# GridCacheSemaphoreImpl.initCnt - what is this for? Can we just remove it?
# Do you think we really need {{fair}} semaphore? I doubt if this makes sense 
with distributed semaphore.
# Do not forget about Apache copyright - I added missing

I pushed my changes to {{ignite-638}} branch. Please review them and address my 
comments basing on mentioned branch.

Looking forward to getting an update and next contribution!

> Implement IgniteSemaphore data structure
> 
>
> Key: IGNITE-638
> URL: https://issues.apache.org/jira/browse/IGNITE-638
> Project: Ignite
>  Issue Type: Sub-task
>  Components: data structures
>Affects Versions: sprint-9
>Reporter: Dmitriy Setrakyan
>Assignee: Vladisav Jelisavcic
>  Labels: features, newbie
> Fix For: 1.5
>
>
> We need to add {{IgniteSemaphore}} data structure in addition to other data 
> structures provided by Ignite. {{IgniteSemaphore}} should have similar API to 
> {{java.util.concurrent.IgniteSemaphore}} class in JDK.
> As an example, you can see how 
> [IgniteCountDownLatch|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java]
>  is implemented in 
> [GridCacheCountDownLatchImpl|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java]
>  class.
> In general we need to have an entity in ATOMIC cache storing number of 
> permits and allow user threads to block whenever no more permits are 
> available.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-638) Implement IgniteSemaphore data structure

2015-10-09 Thread Valentin Kulichenko (JIRA)

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

Valentin Kulichenko commented on IGNITE-638:


Hi Vladislav,

I looked through the code and here are my comments:
# I don't see a single test for the new functionality. Please provide good 
coverage including multi-node tests with restarts.
# Example doesn't compile on line 56. Also I think it's a bit too complicated. 
It's main purpose is to show how to use the API, so it needs to be as simple as 
possible.
# {{GridCacheSemaphoreState.isFair()}} will always return {{false}}, because 
the constructor that sets it is never used. I believe it's a bug.
# You throw an exception if initial number of permits is negative. Java 
semaphore allows it and I think we should be consistent.
# Method names should not be abbreviated. E.g., 
{{GridCacheSemaphoreState.getCnt()}} should be 
{{GridCacheSemaphoreState.getCount()}}.
# Braces are not always used according to guidelines [1]. For example, see 
{{DataStructuresProcessor}}, lines 1319-1325.

[1] 
https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines#CodingGuidelines-BracesandIdentation

> Implement IgniteSemaphore data structure
> 
>
> Key: IGNITE-638
> URL: https://issues.apache.org/jira/browse/IGNITE-638
> Project: Ignite
>  Issue Type: Sub-task
>  Components: data structures
>Affects Versions: sprint-9
>Reporter: Dmitriy Setrakyan
>Assignee: Vladisav Jelisavcic
>  Labels: features, newbie
> Fix For: 1.5
>
>
> We need to add {{IgniteSemaphore}} data structure in addition to other data 
> structures provided by Ignite. {{IgniteSemaphore}} should have similar API to 
> {{java.util.concurrent.IgniteSemaphore}} class in JDK.
> As an example, you can see how 
> [IgniteCountDownLatch|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java]
>  is implemented in 
> [GridCacheCountDownLatchImpl|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java]
>  class.
> In general we need to have an entity in ATOMIC cache storing number of 
> permits and allow user threads to block whenever no more permits are 
> available.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-638) Implement IgniteSemaphore data structure

2015-10-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on IGNITE-638:
---

GitHub user vladisav reopened a pull request:

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

IGNITE-638: Implements cache distributed semaphore

This interface provides a rich API for working with distributed semaphore.
Distributed semaphore provides functionality similar to 
java.util.concurrent.Semaphore.

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

$ git pull https://github.com/vladisav/ignite ignite-638

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

https://github.com/apache/ignite/pull/120.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 #120


commit e9567adec4057b0a0528735d4934440f4cd9fee3
Author: vladisav 
Date:   2015-09-25T09:14:18Z

Implements distributed semaphore ignite-638

This interface provides a rich API for working with distributed semaphore.
Distributed semaphore provides functionality similar to 
java.util.concurrent.Semaphore.

commit be332a82711ddd7e9088e00d7f26edd7de407a11
Author: Vladisav Jelisavcic 
Date:   2015-10-01T18:19:32Z

Fixes formatting issues;

commit 77f9deb7f79acb04b73994e83efd4539646073e6
Author: Vladisav Jelisavcic 
Date:   2015-10-03T10:44:02Z

Fixes formatting issues;




> Implement IgniteSemaphore data structure
> 
>
> Key: IGNITE-638
> URL: https://issues.apache.org/jira/browse/IGNITE-638
> Project: Ignite
>  Issue Type: Sub-task
>  Components: data structures
>Reporter: Dmitriy Setrakyan
>Assignee: Vladisav Jelisavcic
>
> We need to add {{IgniteSemaphore}} data structure in addition to other data 
> structures provided by Ignite. {{IgniteSemaphore}} should have similar API to 
> {{java.util.concurrent.IgniteSemaphore}} class in JDK.
> As an example, you can see how 
> [IgniteCountDownLatch|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java]
>  is implemented in 
> [GridCacheCountDownLatchImpl|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java]
>  class.
> In general we need to have an entity in ATOMIC cache storing number of 
> permits and allow user threads to block whenever no more permits are 
> available.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-638) Implement IgniteSemaphore data structure

2015-10-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on IGNITE-638:
---

Github user vladisav closed the pull request at:

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


> Implement IgniteSemaphore data structure
> 
>
> Key: IGNITE-638
> URL: https://issues.apache.org/jira/browse/IGNITE-638
> Project: Ignite
>  Issue Type: Sub-task
>  Components: data structures
>Reporter: Dmitriy Setrakyan
>Assignee: Vladisav Jelisavcic
>
> We need to add {{IgniteSemaphore}} data structure in addition to other data 
> structures provided by Ignite. {{IgniteSemaphore}} should have similar API to 
> {{java.util.concurrent.IgniteSemaphore}} class in JDK.
> As an example, you can see how 
> [IgniteCountDownLatch|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java]
>  is implemented in 
> [GridCacheCountDownLatchImpl|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java]
>  class.
> In general we need to have an entity in ATOMIC cache storing number of 
> permits and allow user threads to block whenever no more permits are 
> available.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-638) Implement IgniteSemaphore data structure

2015-10-03 Thread Vladisav Jelisavcic (JIRA)

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

Vladisav Jelisavcic commented on IGNITE-638:


Thanks, my mistake, I thought the codestyle formatter does it automatically. 
Fixed now. 

> Implement IgniteSemaphore data structure
> 
>
> Key: IGNITE-638
> URL: https://issues.apache.org/jira/browse/IGNITE-638
> Project: Ignite
>  Issue Type: Sub-task
>  Components: data structures
>Reporter: Dmitriy Setrakyan
>Assignee: Vladisav Jelisavcic
>
> We need to add {{IgniteSemaphore}} data structure in addition to other data 
> structures provided by Ignite. {{IgniteSemaphore}} should have similar API to 
> {{java.util.concurrent.IgniteSemaphore}} class in JDK.
> As an example, you can see how 
> [IgniteCountDownLatch|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java]
>  is implemented in 
> [GridCacheCountDownLatchImpl|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java]
>  class.
> In general we need to have an entity in ATOMIC cache storing number of 
> permits and allow user threads to block whenever no more permits are 
> available.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-638) Implement IgniteSemaphore data structure

2015-10-01 Thread Vladisav Jelisavcic (JIRA)

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

Vladisav Jelisavcic commented on IGNITE-638:


Thanks for the comments!
Everything should be okay now (regarding the formatting issues).

System.out.println is only used in IgniteSemaphoreExample (same as in other 
examples).


> Implement IgniteSemaphore data structure
> 
>
> Key: IGNITE-638
> URL: https://issues.apache.org/jira/browse/IGNITE-638
> Project: Ignite
>  Issue Type: Sub-task
>  Components: data structures
>Reporter: Dmitriy Setrakyan
>Assignee: Vladisav Jelisavcic
>
> We need to add {{IgniteSemaphore}} data structure in addition to other data 
> structures provided by Ignite. {{IgniteSemaphore}} should have similar API to 
> {{java.util.concurrent.IgniteSemaphore}} class in JDK.
> As an example, you can see how 
> [IgniteCountDownLatch|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java]
>  is implemented in 
> [GridCacheCountDownLatchImpl|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java]
>  class.
> In general we need to have an entity in ATOMIC cache storing number of 
> permits and allow user threads to block whenever no more permits are 
> available.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-638) Implement IgniteSemaphore data structure

2015-10-01 Thread Anton Vinogradov (JIRA)

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

Anton Vinogradov commented on IGNITE-638:
-

Vladisav,
Thanks for your pull request!
I'd like to ask you make some changes before review:
1) Please refactor code according to Ignite Coding Guidelines. See 
https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines for 
details. I recommend to configure IDEA codestyle.
Important part: According to 
https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines#CodingGuidelines-SemanticUnits
To simplify the recognition of semantic units, the every line of the source 
code should be separated by one empty line except some cases, see wiki for 
details.
Please make sure code contains no redundant newlines.
2) All fields should be marked as final in case they are immutable.
3) Remove @author comments.
4) Use explicit imports only.
5) All annotations must be placed on a separate line, except for @Nullable and 
@Override. Please relocate @Override annotations.
6) System.out.println should be replaced with usage of IgniteLogger.
7) Code like "for(int i=0;i Implement IgniteSemaphore data structure
> 
>
> Key: IGNITE-638
> URL: https://issues.apache.org/jira/browse/IGNITE-638
> Project: Ignite
>  Issue Type: Sub-task
>  Components: data structures
>Reporter: Dmitriy Setrakyan
>Assignee: Vladisav Jelisavcic
>
> We need to add {{IgniteSemaphore}} data structure in addition to other data 
> structures provided by Ignite. {{IgniteSemaphore}} should have similar API to 
> {{java.util.concurrent.IgniteSemaphore}} class in JDK.
> As an example, you can see how 
> [IgniteCountDownLatch|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java]
>  is implemented in 
> [GridCacheCountDownLatchImpl|https://github.com/apache/incubator-ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java]
>  class.
> In general we need to have an entity in ATOMIC cache storing number of 
> permits and allow user threads to block whenever no more permits are 
> available.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)