[ 
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/8/17 4:09 PM:
---------------------------------------------------------------

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


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}
IgniteLock lock = grid(0).reentrantLock("lock", true, true, true);

        final Condition[] cond = new Condition[1];

        IgniteInternalFuture<Void> fut1 = GridTestUtils.runAsync(new 
Callable<Void>() {
            @Override public Void call() throws Exception {
                lock.lock();

                cond[0] = lock.newCondition();

                cond[0].await();

                lock.unlock();

                return null;
            }
        });

        Thread.sleep(3000);

        IgniteInternalFuture<Void> fut2 = GridTestUtils.runAsync(new 
Callable<Void>() {
            @Override public Void call() throws Exception {
                lock.lock();
                
                cond[0].signalAll();

                lock.unlock();

                return null;
            }
        });

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

                return fut1.isDone() && fut2.isDone();
            }
        }, 3000));
{code}
This simple scenario fails on final assert. Is it a bug ?

> 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