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

Alexey Kuznetsov edited comment on IGNITE-9 at 8/9/17 8:01 AM:
---------------------------------------------------------------

[~yzhdanov] I have some questions on this ticket :
1) Whether IngniteReentrantReadWriteLock must work the same as 
java.util.concurrent.locks.ReentrantReadWriteLock(when you have only one node 
in cluster) ?
2) Whether all methods in IngniteReentrantReadWriteLock must work fully shared 
on cluster(locks on one node, must be seen by another node. Signals could wake 
up threads on another nodes and so on) ?

PS. Implementation of java ReadWriteLock in Ignite (GridCacheLockImpl) doesn't 
meet requirements above.


was (Author: alexey kuznetsov):
[~yzhdanov] Currently, as it implemented at *GridCacheLockImpl* when one node 
waits on condition, signal (on condition with the same name, with the same 
lock) from another node cannot awake it.
Only signal from the same node works.(attached test for it).

Should we provide the same behavior for *IngniteReentrantReadWriteLock*, for 
read lock and write lock ? Or, is it a bug and we should provide signal\await 
shared on all cluster nodes?

Why do we need to provide name when creating condition in  
org.apache.ignite.IgniteLock#getOrCreateCondition()?(As conditions from 
different nodes seems not to be connected)

And the last one.
Take a look at this simple test scenario (signal from one thread must awake 
thread waiting on condition) :

{code:java}
 public void testSimpleSignaling() throws InterruptedException, 
IgniteCheckedException {
        IgniteLock lock = grid(0).reentrantLock("lock", true, true, true);

        IgniteInternalFuture<Void> fut1 = GridTestUtils.runAsync(new 
Callable<Void>() {
            @Override public Void call() throws Exception {
                IgniteLock lock = grid(0).reentrantLock("lock", true, true, 
false);

                lock.lock();

                IgniteCondition cond = lock.getOrCreateCondition("cond");

                cond.await();

                lock.unlock();

                return null;
            }
        });

        lock.lock();

        IgniteCondition cond = lock.getOrCreateCondition("cond");

        cond.signalAll();

        assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
            @Override public boolean apply() {

                return fut1.isDone();
            }
        }, 3000));

        lock.unlock();
    }
{code}
This simple scenario fails on final assert. Is it a bug ?(the test is attached 
IgniteReentrantReadWriteLockSelfTest2)

> Need to implement IngniteReentrantReadWriteLock
> -----------------------------------------------
>
>                 Key: IGNITE-9
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9
>             Project: Ignite
>          Issue Type: Task
>          Components: general
>            Reporter: Yakov Zhdanov
>            Assignee: Alexey Kuznetsov
>         Attachments: IgniteReentrantReadWriteLockSelfTest2.java, 
> IgniteReentrantReadWriteLockSelfTest.java
>
>
> See org.apache.ignite.IgniteLock for reference



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

Reply via email to