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

Vladisav Jelisavcic commented on IGNITE-638:
--------------------------------------------

Yakov, 

thanks for the comments! I will try to fix those asap.

1. The main reason I introduced the 
org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreImpl.Sync#threadMap
 and a global thread waiting counter is to remain consistent with the 
java.util.concurrent.Semaphore, i think it is the only way to implement 
getQueueLength() method; I guess we could remove this method, and save on 
complexity/cache operations, what do you think? 
2. and 3. I'll add those asap.
4. Your'e right; I will remove this one.
5. Ok, I'll remove fairness parameter. 
6. Thanks, i don't know how I missed that.

7. I guess if we allow for the nodes that already acquired the semaphore to 
leave grid we need at least to inform the user about it somehow. Let say NODE_A 
already changed some global variable before it dies; than if we simply release 
the permit, others will continue with the corrupted state. 

Does it makes sense to have an aditional boolean parameter failoverSafe, in 
case this parameter is false exception is thrown whenever node that acquired 
the semaphore leaves the grid, and if the parameter is true, acquired permits 
are released silently?

Or we should simply act as if the threads on the failing node are interrupted? 
This is, perhaps, less complex solution but gives less possibilities (semantics 
of the interrupt and node failure are not exactly the same).

Also, I guess we must use the cache replicated mode for the failover to make 
sense.

Thanks,
VJ

> 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)

Reply via email to