You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Andrey Kornev (JIRA)" <ji...@apache.org> on 2016/01/19 10:46:39 UTC

[jira] [Commented] (IGNITE-2399) Add asynchronous acquire to IgniteSemaphore

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

Andrey Kornev commented on IGNITE-2399:
---------------------------------------

In order to support async actions (as per ticket description) the method signature should be 

{code}
<T> IgniteFuture<T> acquireAndExecute(Callable<IgniteFuture<T>> action, int numPermits);
{code}

Such signature makes the contract explicit, and more importantly it correctly unwraps the input future to return the type T and not {{IgniteFuture<T>}} as would be the case with the original signature.

> Add asynchronous acquire to IgniteSemaphore
> -------------------------------------------
>
>                 Key: IGNITE-2399
>                 URL: https://issues.apache.org/jira/browse/IGNITE-2399
>             Project: Ignite
>          Issue Type: Improvement
>          Components: data structures
>            Reporter: Vladisav Jelisavcic
>             Fix For: 1.6
>
>
> Usually a permit acquisition is followed by an action, followed by a release of the permit. A simple enhancement to the existing Semaphore API can be made that enables asynchronous acquire:
> <T> IgniteFuture<T> acquireAndExecute(Callable<T> action, int numPermits);
> The method would immediately return a future to be later completed by the action's result. Permits are to be released after the future is completed.



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